mde / timezone-js

DEPRECATED: Timezone-enabled JavaScript Date object. Uses Olson zoneinfo files for timezone data.
824 stars 183 forks source link

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

Closed craigstanton closed 4 years ago

craigstanton commented 10 years ago

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

craigstanton commented 10 years ago

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"