Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion frontend/src/lib/prefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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;
})();