0

I need to get UTC offset and DST information for a specific timezone in node.js. In case i use an external web service, it is necessary that the service used is free with unlimited requests if it's possible.

Example: if i put Europe/Rome timezone as a parameter i need to have 3600 as utc offset and 0 as DST information.

I found timezonedb but there is a rate limit where you can only send request to the server once per second.

  • Keep in mind that you can only get an offset for a time zone *for a specific point in time*. DST is not the only way in which time zones vary their offset over time. Many have made changes to their standard time - sometimes multiple times! – Matt Johnson-Pint Dec 18 '18 at 19:31

1 Answers1

1

For anything time related you should look into using moment.js

Here is the documentation for moment.js Here is the documentation for moment.js timezone

Below is taken from the moment.js timezone docs

var jun = moment("2014-06-01T12:00:00Z");
var dec = moment("2014-12-01T12:00:00Z");

jun.tz('America/Los_Angeles').format('ha z');  // 5am PDT
dec.tz('America/Los_Angeles').format('ha z');  // 4am PST

jun.tz('America/New_York').format('ha z');     // 8am EDT
dec.tz('America/New_York').format('ha z');     // 7am EST

You should be able to find the correct methods based on your use case.

Rastalamm
  • 1,712
  • 3
  • 23
  • 32