3

I'm working on an Nodejs system support multi timezone users. Currently, I'm using moment.tz.names() to get list of available timezone. But I found out that some timezone in list is deprecated by this link. I also found this database from IANA. So is there anyway to keep my timezone data up to date? I'm trying to find a way to work with IANA database. Thank you if there are any other approaches.

Nguyen Hoang Vu
  • 751
  • 2
  • 14
  • 35

1 Answers1

3

I'd take a look at the tzdb package. It includes all IANA zones and is automatically updated on changes. You can get a list of timezones easily:

const { getTimeZones } = require("@vvo/tzdb");
const timeZones = getTimeZones();

console.log("Timezone (Berlin):", timeZones.find(tz => tz.name === "Europe/Berlin"));
console.log("Timezone (LA):", timeZones.find(tz => tz.name === "America/Los_Angeles"));
Terry Lennox
  • 29,471
  • 5
  • 28
  • 40