In browsers, it's window but in node.js it's global. TimeShift-js fails to assign the latter into the root variable where it looks for root.Date. Thus, if you require('timeshift-js') in Node.js, it errors out when it does:
var OriginalDate = root.Date;
var timezoneOffset = new OriginalDate().getTimezoneOffset();
// OriginalDate is undefined
This PR fixes that, and meanwhile tests continue to pass in Chrome, Firefox and Safari. I've been playing around with it and once that specific issue is fixed, this lib works great in Node.
In browsers, it's
window
but in node.js it'sglobal
. TimeShift-js fails to assign the latter into theroot
variable where it looks forroot.Date
. Thus, if yourequire('timeshift-js')
in Node.js, it errors out when it does:This PR fixes that, and meanwhile tests continue to pass in Chrome, Firefox and Safari. I've been playing around with it and once that specific issue is fixed, this lib works great in Node.