fix: allow datepicker to send empty values

This commit is contained in:
Jacob Overgaard
2024-07-23 10:35:38 +02:00
parent 9c73426e0f
commit c8ce7fb876

View File

@@ -75,6 +75,11 @@ export class UmbPropertyEditorUIDatePickerElement extends UmbLitElement implemen
#onChange(event: CustomEvent & { target: UmbInputDateElement }) {
let value = event.target.value.toString();
if (!value) {
this.#syncValue(undefined);
return;
}
switch (this._inputType) {
case 'time':
value = `0001-01-01 ${value}`;
@@ -120,7 +125,7 @@ export class UmbPropertyEditorUIDatePickerElement extends UmbLitElement implemen
}
}
#syncValue(value: string) {
#syncValue(value?: string) {
const valueHasChanged = this.value !== value;
if (valueHasChanged) {
this.value = value;