mde/timezone-js

setTime for UTC time results in incorrect local and UTC time

rogierschouten opened this issue · 1 comments

Initializing a timezoneJS UTC Date with setTime() results in a plain incorrect date. I checked d.valueOf() using unixtimestamp.com and the javascript Date returns the correct unix timestamp.

var d: Date = new Date("2014-10-26T01:59:59.000Z");
var t = new timezoneJS.Date("UTC");
t.setTime(d.valueOf());
// FAIL: returns 02:59:59
expect(t.toUTCString()).to.equal("Sun, 26 Oct 2014 01:59:59 GMT"); 

Note my system is set to Europe/Amsterdam so this is within a DST backward change. I don't see how that should affect this UTC-only conversion though.