I am trying to convert timestamp in to various time zone's local time and found certain TimeZone are not supporting in Chrome (v76.0.38) but working fine in Mozilla (v68.0.2).
let d = new Date(1567083463);
let n = d.toLocaleString('en-GB', { timeZone: "US/Arizona" });
Uncaught RangeError: Invalid time zone specified: US/Arizona
at Date.toLocaleString ()
Several other timezones are also throwing the same error
US/Alaska
US/Mountain
US/Central
US/East-Indiana
These timezones are officially supported as mentioned in their website Chrome Supported Time Zone Values
That page describes timezones supported by another google product, not Chrome.
Referring to MDN's documentation on toLocaleString
:
timeZone
The time zone to use. The only value implementations must recognize is "UTC"; the default is the runtime's default time zone. Implementations may also recognize the time zone names of the IANA time zone database, such as "Asia/Shanghai", "Asia/Kolkata", "America/New_York".
Valid time zones can be found at that IANA link, or you can use Wikipedia: List of tz database time zones. You'll notice that all of the "US/*" timezones are deprecated. Use only Canonical entries from the Wikipedia page, such as:
etc.