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 = ;console;// Sat Sep 19 2017 02:39:56 GMT+0300 (Ixania Daylight Time)const UtcDate = timezonedDate;console;// Fri Sep 18 2017 23:39:56 GMT+0000 (UTC)globalDate = timezonedDate; // minutesconsole;// Sat Sep 19 2017 03:39:56 GMT+0400
An example of using it with jsdom:
const dom = `<p>Hello</p>` { windowDate = timezonedDate; };
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