mde/timezone-js

getTimezoneOffset() does not work with DST

Closed this issue · 2 comments

ver 0.4.12

Europe/Warsaw timezone ends DST 2014-10-26 02:59+02 -> 2014-10-26 02:00+01

//1414281600 = 2014-10-26 02:00+02
(new timezoneJS.Date(1414281600 * 1000, 'Europe/Warsaw')).getTimezoneOffset()  // -120 OK

//1414285200 = 2014-10-26 02:00+01
(new timezoneJS.Date(1414285200 * 1000, 'Europe/Warsaw')).getTimezoneOffset()  // -120 INVALID

//1414288800 = 2014-10-26 03:00+01
(new timezoneJS.Date(1414288800 * 1000, 'Europe/Warsaw')).getTimezoneOffset()  // -60 OK

Tested on machine with timezone set to 'Europe/Warsaw'. Chrome 38.

mde commented

This looks similar to what we're seeing with Issue #162 -- can you be certain that the native JS Date in the same (OS) timezone doesn't behave the same way?

It's working fine with native Date. Tested under the same conditions.

(new Date(1414281600 * 1000)).getTimezoneOffset()  // -120
(new Date(1414285200 * 1000)).getTimezoneOffset()  // -60
(new Date(1414288800 * 1000)).getTimezoneOffset()  // -60