Skip to content

Intl.DateTimeFormat() returns short timeZoneName with GMT offset removed in some locales #1601

Open
@kueda

Description

Bug Description

Intl.DateTimeFormat() returns short timeZoneName with GMT offset removed in some locales.

  • I have run gradle clean and confirmed this bug does not occur with JSC
  • The issue is reproducible with the latest version of React Native.

Hermes git revision (if applicable):
React Native version: 0.77.0
OS: iOS 18.2.1
Platform (most likely one of arm64-v8a, armeabi-v7a, x86, x86_64): running on iPhone, so I guess one of the arm ones

Steps To Reproduce

Intl.DateTimeFormat(
  "en-GB",
  { timeZone: "Pacific/Honolulu", timeZoneName: "short" }
)
  .formatToParts( new Date( ) )
  .find( p => p.type === "timeZoneName" ).value

gives the following output

GMT

The Expected Behavior

GMT-10

FWIW, I see the correct output in Android 14, and by "correct" I mean the output I see in Firefox and Chrome, GMT-10 (I would expect it to be HST like it is in en-US, but an accurate offset seems preferable to an inaccurate short name).

I am pretty sure this is just due to formatToParts() behaving a bit differently. The - and 10 are in subsequent parts as literal and year elements. That's just not how the method behaves in a browser.

Related: marnusw/date-fns-tz#306

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions