Intl.supportedValuesOf('timeZone')
Above code will give list of all time zone in en-US like below
["Africa/Abidjan", "Africa/Accra" , "Africa/Addis_Ababa", ...]
Is there way to get list of all time zone in desire language.
-
5Those names are identifiers, not localized names.Mark Rotteveel– Mark Rotteveel2025年04月16日 13:25:51 +00:00Commented Apr 16, 2025 at 13:25
1 Answer 1
Above code will give list of all time zone in en-US
It looked like you think en-US (the locale) would select the time zone identifiers for that locale.
locale and timeZone are not related. You can for example format a date in the locale en-US for timeZone Asia/Shanghai.
const myDate = new Date(`2000年01月01日`);
console.log(
[myDate.toLocaleString(`en-US`, {timeZone: `Asia/Shanghai`}),
myDate.toLocaleString(`zh`, {timeZone: `Asia/Shanghai`}),
myDate.toLocaleString(`en-CA`, {timeZone: `Pacific/Auckland`}),].join(`\n`)
);
So, afaik using JS Date, it is not possible to retrieve a time zone from a locale.
In this Stackblitz project I have related a number of cities to their time zone, using world-timedate.com which was quite cumbersome.
Here is a library I created to make working with JS Dates a bit more easy. Maybe it's useful.
1 Comment
Intl.supportedValuesOf('timeZone') provides) using Intl.DateTimeFormat jsbin.com/tereyituzi/1/edit?js,console However, you can't get the IANA name localised. These are the options for the time zone name.Explore related questions
See similar questions with these tags.