'toLocaleString is not working in react Native

to convert given date and time as par "new york" timezone, tried following, it works perfect but only on android emulator, But when tested on an actual device gives an invalid date

const date = new Date("2019-08-12T09:58:00.000Z")
  .toLocaleString("en-US", {
    timeZone: "America/New_York"
  });

console.log(date);


Solution 1:[1]

You'll see this problem if you're using Hermes or some Android JS engines, but it's easy enough to polyfill.

yarn add intl

In your index.js or other base file:

import 'intl';
import 'intl/locale-data/jsonp/en';

And now it works properly throughout your app.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Stephen Saucier