timezoned-date

Constructors and objects behave exactly like built-in Date
; the TZ offset is configurable
Tested against Test262 for the compatibility with Date
.
No support for daylight saving time. Fixed offsets only.
Install
$ npm install --save timezoned-date
Usage
const timezonedDate = require('timezoned-date');
console.log(new Date());
const UtcDate = timezonedDate.makeConstructor(0);
console.log(new UtcDate());
global.Date = timezonedDate.makeConstructor(240);
console.log(new Date());
An example of using it with jsdom:
const dom = new JSDOM(`<p>Hello</p>`, {
beforeParse(window) {
window.Date = timezonedDate.makeConstructor(240);
}
});
API
makeConstructor(offsetInMinutes)
Returns a constructor function compatible with Date
bound to the specified offset.
License
Apache 2.0 © 2013-2017 James A. Rosen, Georgii Dolzhykov