From 2659834647d64e39b21d33296b802e3a84a983c7 Mon Sep 17 00:00:00 2001 From: pphuc25 Date: Fri, 4 Dec 2026 14:39:03 +0700 Subject: [PATCH] fix(frontend): populate profile timezones via Intl.supportedValuesOf --- frontend/src/lib/prefs.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/prefs.ts b/frontend/src/lib/prefs.ts index 7bb83452..5e792e70 100644 --- a/frontend/src/lib/prefs.ts +++ b/frontend/src/lib/prefs.ts @@ -68,12 +68,14 @@ export function weekDays(translateFn?: (key: string) => string): string[] { return [0, 1, 2, 3, 4, 5, 6].map((i) => weekdayName(i, translateFn)); } -export const TIMEZONES = [ +const FALLBACK_TIMEZONES = [ 'Pacific/Auckland', 'Australia/Sydney', 'Australia/Melbourne', 'Asia/Tokyo', 'Asia/Singapore', + 'Asia/Ho_Chi_Minh', + 'Asia/Bangkok', 'Asia/Dubai', 'Europe/London', 'Europe/Paris', @@ -85,3 +87,15 @@ export const TIMEZONES = [ 'America/Los_Angeles', 'UTC' ]; + +export const TIMEZONES: string[] = (() => { + if (typeof Intl !== 'undefined' && typeof Intl.supportedValuesOf === 'function') { + try { + // Include fallback entries so canonical aliases like UTC and Asia/Ho_Chi_Minh are not omitted by CLDR. + return Array.from(new Set([...Intl.supportedValuesOf('timeZone'), ...FALLBACK_TIMEZONES])).sort(); + } catch { + return FALLBACK_TIMEZONES; + } + } + return FALLBACK_TIMEZONES; +})();