From 66418bf591741d9522d8edd2ec4fa49bada1d10c Mon Sep 17 00:00:00 2001 From: Aicha Lassoued Date: Sun, 26 Apr 2026 18:25:53 +0100 Subject: [PATCH 1/2] fix: prevent blank screen crash when clearing timezone search field --- client/src/Features/UI/uiSlice.ts | 4 +++- client/src/Pages/Settings/index.tsx | 4 ++-- client/src/Utils/TimeUtils.ts | 7 +++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/client/src/Features/UI/uiSlice.ts b/client/src/Features/UI/uiSlice.ts index 84e8248db..be54eead8 100644 --- a/client/src/Features/UI/uiSlice.ts +++ b/client/src/Features/UI/uiSlice.ts @@ -89,7 +89,9 @@ const uiSlice = createSlice({ }, setTimezone: (state, action: PayloadAction<{ timezone: string }>) => { - state.timezone = action.payload.timezone; + if (action.payload.timezone) { + state.timezone = action.payload.timezone; + } }, setLanguage: (state, action: PayloadAction) => { state.language = action.payload; diff --git a/client/src/Pages/Settings/index.tsx b/client/src/Pages/Settings/index.tsx index 302ce9ab2..f9cf09b7c 100644 --- a/client/src/Pages/Settings/index.tsx +++ b/client/src/Pages/Settings/index.tsx @@ -127,8 +127,8 @@ export const SettingsPage = () => { timezoneOptions.find((tz) => tz.id === selectedTimezoneId) ?? null; const handleTimezoneChange = (newValue: Timezone | null) => { - const newId = newValue?.id ?? ""; - dispatch(setTimezone({ timezone: newId })); + if (!newValue?.id) return; + dispatch(setTimezone({ timezone: newValue.id })); }; const handleModeChange = (e: SelectChangeEvent) => { diff --git a/client/src/Utils/TimeUtils.ts b/client/src/Utils/TimeUtils.ts index abd56ce44..cffdd5440 100644 --- a/client/src/Utils/TimeUtils.ts +++ b/client/src/Utils/TimeUtils.ts @@ -19,8 +19,11 @@ export const formatDateWithTz = (timestamp: string, format: string, timezone: st if (!timestamp) { return "Unknown time"; } - const formattedDate = dayjs(timestamp).tz(timezone).format(format); - return formattedDate; + try { + return dayjs(timestamp).tz(timezone).format(format); + } catch { + return dayjs(timestamp).utc().format(format); + } }; export const tickDateFormatLookup = (range: string) => { From 5a72a11ac2af82e867045edd2784764f51e8863f Mon Sep 17 00:00:00 2001 From: Aicha Lassoued Date: Sun, 26 Apr 2026 18:40:04 +0100 Subject: [PATCH 2/2] (client): format code change --- client/src/Pages/Settings/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/Pages/Settings/index.tsx b/client/src/Pages/Settings/index.tsx index f9cf09b7c..b14ee959d 100644 --- a/client/src/Pages/Settings/index.tsx +++ b/client/src/Pages/Settings/index.tsx @@ -127,7 +127,7 @@ export const SettingsPage = () => { timezoneOptions.find((tz) => tz.id === selectedTimezoneId) ?? null; const handleTimezoneChange = (newValue: Timezone | null) => { - if (!newValue?.id) return; + if (!newValue?.id) return; dispatch(setTimezone({ timezone: newValue.id })); };