feat: add LocaleProvider and hooks for managing locale and timezone settings
This commit is contained in:
14
src/lib/utils/locale.ts
Normal file
14
src/lib/utils/locale.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
// Get supported timezones, fallback to basic list if Intl.supportedValuesOf is not available
|
||||
export const getSupportedTimezones = (): string[] => {
|
||||
try {
|
||||
if (typeof Intl !== 'undefined' && 'supportedValuesOf' in Intl) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
return (Intl as any).supportedValuesOf('timeZone')
|
||||
}
|
||||
} catch {
|
||||
console.warn('Intl.supportedValuesOf not available, using fallback timezones')
|
||||
}
|
||||
|
||||
// Fallback timezone list
|
||||
return ['America/New_York', 'Europe/Paris']
|
||||
}
|
||||
Reference in New Issue
Block a user