-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
There seems to be a bug in getUnixTime
. The unix timestamp is incorrectly generated just after the change to PDT.
I've validated the result and compared the behavior to moment-timezone. See test case below
const moment = require('moment-timezone');
const { findTimeZone, getUnixTime } = require('timezone-support');
const unix1 = getUnixTime(
{ year: 2018, month: 3, day: 11, hours: 5 },
findTimeZone('America/Vancouver')
) / 1000;
console.log(unix1);
// => 1520773200
// => 1520773200 converts to Sunday March 11, 2018 06:00:00 (am) in time zone America/Vancouver (PDT)
// Reference: https://www.epochconverter.com/timezones?q=1520773200&tz=America%2FVancouver
const unix2 = moment.tz('2018-03-11T05:00:00', 'America/Vancouver').unix();
console.log(unix2);
// => 1520769600
// => 1520769600 converts to Sunday March 11, 2018 05:00:00 (am) in time zone America/Vancouver (PDT)
// Reference: https://www.epochconverter.com/timezones?q=1520769600&tz=America%2FVancouver
Would be great if this could be fixed. It has caused me some headaches as I'm trying to improve performance by migrating from moment-timezone
to timezone-support
.
Thank you very much for your consideration!
ealanisg, pbadenski, cthrax and phillipskevin
Metadata
Metadata
Assignees
Labels
No labels