fix: resolve timezone properly in TimezoneSelector and EventModal

- Resolve timezone alias to main timezone in TimezoneSelector before passing to TimezoneAutocomplete
- Resolve timezone in EventModal useState initialization to ensure correct timezone display
- Sync resolved timezone when modal opens or Redux timezone changes
- Ensure timezone is always resolved in resetAllStateToDefault callback
- Fix issue where TimezoneAutocomplete doesn't show correct timezone on first load
This commit is contained in:
lenhanphung
2025-10-16 16:16:05 +07:00
committed by Benoit TELLIER
parent 6421f53a8d
commit ed8bb41ca9
3 changed files with 16 additions and 5 deletions
+5 -2
View File
@@ -20,7 +20,10 @@ export function TimezoneSelector({ value, onChange }: TimezoneSelectProps) {
return { zones, browserTz, getTimezoneOffset };
}, []);
const selectedOffset = getTimezoneOffset(value);
const effectiveTimezone = value
? resolveTimezone(value)
: timezoneList.browserTz;
const selectedOffset = getTimezoneOffset(effectiveTimezone);
const handleOpen = (event: MouseEvent<HTMLElement>) => {
setAnchorEl(event.currentTarget);
@@ -68,7 +71,7 @@ export function TimezoneSelector({ value, onChange }: TimezoneSelectProps) {
}}
>
<TimezoneAutocomplete
value={value}
value={effectiveTimezone}
onChange={onChange}
zones={timezoneList.zones}
getTimezoneOffset={getTimezoneOffset}