The Intl.Locale.prototype.timeZones
property is an accessor property which returns an array of supported time zones for a chosen Locale
.
Intl.Locale.prototype.timeZones
Description
Returns an array with supported time zones for the associated Locale
, returned time zones represents an IANA time zone.
Note: If the Unicode Language Identifier does not contain the -
for the Unicode region subtag sequence, the returned value is undefined
Examples
Obtaining supported time zones
List supported time zones for a given Locale
.
let arEG = new Intl.Locale("ar-EG"); console.log(arEG.timeZones); // logs ["Africa/Cairo"]
let jaJP = new Intl.Locale("ja-JP"); console.log(jaJP.timeZones); // logs ["Asia/Tokyo"]
let ar = new Intl.Locale("ar"); console.log(ar.timeZones); // logs undefined
Specifications
Browser compatibility
Desktop | Mobile | Server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | Deno | Node.js | |
timeZones |
99
92-99
|
99
92-99
|
No
|
No
|
85
78-85
|
15.4
|
99
|
99
92-99
|
No
|
No
|
15.4
|
No
|
No
|
No
|
See also
© 2005–2022 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/timeZones