Issue #14 invalid

Timezones and DST

Anonymous created an issue


Firstly, I would like to thank you for creating such a great script.

What can be done to get the real UTC-/+X:00, according to DST ? I mean I get e.g. UTC+1:00 and DST: Yes, but the real timezone is UTC+2:00.

The only solution I came up with is to create a database/array with every country and their rules about DST and presenting the data according to it.

Is there any other, better solution?

Comments (3)

  1. Jon Nylander repo owner

    There is already such a database. It is called the timezone information database. Or the "Olson" database. Most programming languages implement it and you can use the keys that this script produces to get information about the offset from DST regardless of time of year.

    Also, in JavaScript, if you want to know what the offset is at any particular moment, without caring about whether it is DST or not. Then you can simply do:

        var now = new Date();
        var hours_offset = now.getTimezoneOffset() / 60;

    I am in Sweden so my offset is 1 hour, but during DST it is 2 hours. So since it is summer now, the above script returns "2" for me.

  2. Anonymous

    Thank you for your answer.

    Unfortunately, your JS code seems to work incorrectly - my timezone should be UTC+2 and I get UTC-2 instead.

  3. Log in to comment