From 3cd64a5a6fd99eb1bb2a81fbc7be176a1ccfcc28 Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Fri, 3 May 2024 11:09:50 +0200 Subject: [PATCH] fix: add handling for a "time only" picker where the value contains a date part --- .../date-picker/property-editor-ui-date-picker.element.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/property-editors/date-picker/property-editor-ui-date-picker.element.ts b/src/Umbraco.Web.UI.Client/src/packages/property-editors/date-picker/property-editor-ui-date-picker.element.ts index b32cf266c4..306a389797 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/property-editors/date-picker/property-editor-ui-date-picker.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/property-editors/date-picker/property-editor-ui-date-picker.element.ts @@ -43,7 +43,6 @@ export class UmbPropertyEditorUIDatePickerElement extends UmbLitElement implemen set value(value: string | undefined) { // Replace the potential time demoninator 'T' with a whitespace for backwards compatibility this.#value = value?.replace('T', ' '); - console.log('got value', value, 'translated to', this.#value); } get value() { return this.#value; @@ -68,10 +67,15 @@ export class UmbPropertyEditorUIDatePickerElement extends UmbLitElement implemen this._max = config.getValueByAlias('max'); this._step = config.getValueByAlias('step'); - // If the inputType is only 'date' we need to make sure the value doesn't have a time + // If the inputType is 'date', we need to make sure the value doesn't have a time if (this._inputType === 'date' && this.value?.includes(' ')) { this.value = this.value.split(' ')[0]; } + + // If the inputType is 'time', we need to remove the date part of the value + if (this._inputType === 'time' && this.value?.includes(' ')) { + this.value = this.value.split(' ')[1]; + } } #onChange(event: CustomEvent & { target: UmbInputDateElement }) {