Methods for listing supported time zones and reading the current environment time zone details.
const timeZones = Intl.supportedValuesOf('timeZone')
const currentTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone
const dateTimeFormatOptions = Intl.DateTimeFormat().resolvedOptions()
Example of usage:
console.log(timeZones)
// ['Africa/Abidjan', 'Africa/Accra', 'Africa/Addis_Ababa', ...]
// and many many more..
console.log(currentTimeZone)
// 'Europe/Warsaw'
console.log(dateTimeFormatOptions)
/*
{
"locale": "pl",
"calendar": "gregory",
"numberingSystem": "latn",
"timeZone": "Europe/Warsaw",
"year": "numeric",
"month": "2-digit",
"day": "numeric"
}
*/
Go back to shorts