Ideal fix, doesn't work

This commit is contained in:
Eric Bailey
2024-12-19 15:26:12 -06:00
parent a3031de19b
commit 222625a7d4
+15
View File
@@ -9,6 +9,7 @@ import '@formatjs/intl-pluralrules/locale-data/en'
import '@formatjs/intl-numberformat/locale-data/en'
import {useEffect} from 'react'
import {getCalendars} from 'expo-localization'
import {i18n} from '@lingui/core'
import {sanitizeAppLanguageSetting} from '#/locale/helpers'
@@ -46,6 +47,20 @@ import {messages as messagesZh_HK} from '#/locale/locales/zh-HK/messages'
import {messages as messagesZh_TW} from '#/locale/locales/zh-TW/messages'
import {useLanguagePrefs} from '#/state/preferences'
/**
* Set default time zone for Intl.DateTimeFormat polyfill from formatjs
* {@link https://formatjs.github.io/docs/polyfills/intl-datetimeformat/#default-timezone}
*
* According to docs, `getCalendars` is guaranteed to have at least one
* calendar, and for now this ONLY returns one calendar.
* {@link https://docs.expo.dev/versions/latest/sdk/localization/#localizationgetcalendars}
*/
if ('__setDefaultTimeZone' in Intl.DateTimeFormat) {
console.log('Setting default time zone', getCalendars()[0].timeZone)
// @ts-ignore
Intl.DateTimeFormat.__setDefaultTimeZone(getCalendars()[0].timeZone)
}
/**
* We do a dynamic import of just the catalog that we need
*/