diff --git a/web/src/lib/components/shared-components/change-date.svelte b/web/src/lib/components/shared-components/change-date.svelte index a6818ee1fd..23789a123f 100644 --- a/web/src/lib/components/shared-components/change-date.svelte +++ b/web/src/lib/components/shared-components/change-date.svelte @@ -28,7 +28,7 @@ const initialOption = timezones.find((item) => item.value === 'UTC' + initialDate.toFormat('ZZ')); - let selectedOption = { + let selectedOption = initialOption && { label: initialOption?.label || '', value: initialOption?.value || '', }; @@ -36,7 +36,7 @@ let selectedDate = initialDate.toFormat("yyyy-MM-dd'T'HH:mm"); // Keep local time if not it's really confusing - $: date = DateTime.fromISO(selectedDate).setZone(selectedOption.value, { keepLocalTime: true }); + $: date = DateTime.fromISO(selectedDate).setZone(selectedOption?.value, { keepLocalTime: true }); const dispatch = createEventDispatcher<{ cancel: void; @@ -82,7 +82,7 @@