From a31825ce3a6f2c20ea74bc325028d88a8d5a55f2 Mon Sep 17 00:00:00 2001 From: lenhanphung Date: Fri, 10 Oct 2025 17:38:57 +0700 Subject: [PATCH] fix: set timezone changes as repetition rule changes for recurring events --- src/features/Events/EventUpdateModal.tsx | 26 +++++++++++------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/features/Events/EventUpdateModal.tsx b/src/features/Events/EventUpdateModal.tsx index 8660ca3..e300da0 100644 --- a/src/features/Events/EventUpdateModal.tsx +++ b/src/features/Events/EventUpdateModal.tsx @@ -495,22 +495,20 @@ function EventUpdateModal({ const oldRepetition = normalizeRepetition(event.repetition); const newRepetition = normalizeRepetition(repetition); - console.log("[DEBUG] Repetition comparison:", { - old: oldRepetition, - new: newRepetition, - oldRaw: event.repetition, - newRaw: repetition, - }); + // Normalize timezone for comparison (undefined, null, "" → null, resolve aliases) + const normalizeTimezone = (tz: string | undefined | null) => { + if (!tz) return null; + // Resolve timezone aliases (e.g., Asia/Saigon → Asia/Ho_Chi_Minh) + return resolveTimezone(tz); + }; + + const oldTimezone = normalizeTimezone(event.timezone); + const newTimezone = normalizeTimezone(timezone); + const timezoneChanged = oldTimezone !== newTimezone; const repetitionRulesChanged = - JSON.stringify(oldRepetition) !== JSON.stringify(newRepetition); - - console.log("[DEBUG] repetitionRulesChanged =", repetitionRulesChanged); - console.log( - repetitionRulesChanged - ? "[RELOAD] Repetition rules changed" - : "[OPTIMISTIC] Properties only" - ); + JSON.stringify(oldRepetition) !== JSON.stringify(newRepetition) || + timezoneChanged; if (repetitionRulesChanged) { // Repetition rules changed - need server to recalculate instances