facebook / hermes

A JavaScript engine optimized for running React Native.
https://hermesengine.dev/
MIT License
9.41k stars 596 forks source link

Intl.DateTimeFormat does not support 'Europe/Kyiv' timezone #1342

Closed jasonblickhan closed 2 months ago

jasonblickhan commented 2 months ago

Bug Description

It appears that the Europe/Kiev timezone has been renamed to Europe/Kyiv as of March 10, 2022 (per the IANA Database changelog).

Currently, the following code:

Intl.DateTimeFormat('en', {timeZone: 'Europe/Kyiv'}).format(new Date());

produces a crash with this error: com.facebook.hermes.intl.JSRangeErrorException: Invalid timezone name!

We are using the @formatjs polyfill on iOS which supports both IANA timezones while Hermes' Intl only looks to be supporting the old Europe/Kiev timezone.

Hermes git revision (if applicable): React Native version: 0.72.8 Platform: Android OS:

Steps To Reproduce

Attempt to format using the Europe/Kyiv timezone on Android using Hermes' Intl library.

Intl.DateTimeFormat('en', {timeZone: 'Europe/Kyiv'}).format(new Date());

The Expected Behavior

It should correctly format the date rather than crash.

tmikov commented 2 months ago

Hermes does not have its own timezone table, it uses whatever is provided by the OS.

tmikov commented 2 months ago

Just tried it on MacOS, which presumably has the latest timezones, works as expected.