Skip to content

Intl.DateTimeFormat throws and RangeError "Invalid timezone name!" when valid IANA timezone is provided #572

@anton-patrushev

Description

@anton-patrushev

Bug Description

Intl.DateTimeFormat API for Android is broken. Please see Steps To Reproduce section to understand the problem.

  • I have run gradle clean and confirmed this bug does not occur with JSC

Hermes version: 0.8.1
React Native version (if any): 0.65.0-rc.4
OS version (if any): macOS BigSur 11.5.1 (Intel)
Platform (most likely one of arm64-v8a, armeabi-v7a, x86, x86_64): x86

Steps To Reproduce

  1. call Intl.DateTimeFormat with valid IANA timeZone

code example:

const date = new Date('2021-08-13T14:00:00Z');

console.log(
  Intl.DateTimeFormat(undefined, {
    timeZone: 'America/New_York',
    month: 'numeric',
    day: 'numeric',
    hour: 'numeric',
    minute: 'numeric',
  }).format(date),
);

Actual Behavior

Throws an RangeError: com.facebook.hermes.intl.JSRangeErrorException: Invalid timezone name!, js engine: hermes

The Expected Behavior

Should not throw any errors and print to console "8/13, 10:00 AM"

Metadata

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