Closed ntnp closed 6 months ago
It's a Hermes issue.
Fixed by pollyfilling Intl.DateTimeFormat
:
// in index.js
require('@formatjs/intl-getcanonicallocales/polyfill');
require('@formatjs/intl-locale/polyfill');
require('@formatjs/intl-datetimeformat/polyfill');
require('@formatjs/intl-datetimeformat/locale-data/en');
require('@formatjs/intl-datetimeformat/add-golden-tz');
It seems this works w/o the polyfill(s) now.
Describe the bug
toLocaleString()
stopped working for UTC dates on iOS in Expo 51. There are 4 attempts of Intl formatting in the example below: 2 using Intl directly (local and UTC) and 2 using Luxon (local and UTC). The UTC Luxon attempt fails on iOS in Expo 51. WhentoLocaleString()
is called on a UTC date it apparently fails to instantiateIntl.DateTimeFormat
correctly, throwingthis.dtf.formatToParts is not a function (it is undefined)
.To Reproduce Expo Snack Uncomment the
<LuxonUtc />
component on SDK 50 and then on SDK 51.Actual vs Expected behavior Expected: Calling
toLocaleString()
on a UTC date formats it. Actual: CallingtoLocaleString()
on a UTC date fails with an exception.Desktop (please complete the following information):
Additional context Kinda looks like it's on Expo, but idk? It's weird that it affects iOS but not Android or Web.