mde/timezone-js

setTime unable to progress over DST start (NZST to NZDT)

Closed this issue · 1 comments

var d = new Date(2014, 08, 27, 12, 0, 0, 0);
activeTimezone = 'Pacific/Auckland';
d = new timezoneJS.Date(d, activeTimezone);
d.toJSON();//Shows 2014-09-27T12:00:00Z

d.setTime(d.getTime() + 60_60_1000);
d.toJSON();//Shows 2014-09-27T13:00:00Z

d.setTime(d.getTime() + 60_60_1000);
d.toJSON();//STILL shows 2014-09-27T13:00:00Z

Additional testing using Firefox console

x = new timezoneJS.Date("2015-04-04T14:00:00Z", "UTC"); x.toJSON()
"2015-04-04T17:00:00.000Z"
x = new timezoneJS.Date("2015-04-04T14:00:00", "UTC"); x.toJSON()
"2015-04-04T01:00:00.000Z"
x = new timezoneJS.Date("2015-04-04T14:00:00+0000", "UTC"); x.toJSON()
"2015-04-04T17:00:00.000Z"

x = new timezoneJS.Date("2015-04-04T13:59:59Z", "UTC"); x.toJSON()
"2015-04-04T13:59:59.000Z"
x = new timezoneJS.Date("2015-04-04T14:00:00Z", "UTC"); x.toJSON()
"2015-04-04T17:00:00.000Z"
x = new timezoneJS.Date("2015-04-04T14:00:01Z", "UTC"); x.toJSON()
"2015-04-04T17:00:01.000Z"