3.0.2 • Published 8 years ago
timezoned-date v3.0.2
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());
// Sat Sep 19 2017 02:39:56 GMT+0300 (Ixania Daylight Time)
const UtcDate = timezonedDate.makeConstructor(0);
console.log(new UtcDate());
// Fri Sep 18 2017 23:39:56 GMT+0000 (UTC)
global.Date = timezonedDate.makeConstructor(240); // minutes
console.log(new Date());
// Sat Sep 19 2017 03:39:56 GMT+0400
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
3.0.2
8 years ago
3.0.1
8 years ago
3.0.0
8 years ago
2.1.0
8 years ago
2.0.19
9 years ago
2.0.18
9 years ago
2.0.17
9 years ago
2.0.16
9 years ago
2.0.15
9 years ago
2.0.14
9 years ago
2.0.13
9 years ago
2.0.12
9 years ago
2.0.11
9 years ago
2.0.10
9 years ago
2.0.9
9 years ago
2.0.8
9 years ago
2.0.7
10 years ago
2.0.6
10 years ago
2.0.5
10 years ago
2.0.4
10 years ago
2.0.3
10 years ago
2.0.2
10 years ago
2.0.1
10 years ago
2.0.0
10 years ago
2.0.0-alpha.5
10 years ago
2.0.0-alpha.4
10 years ago
2.0.0-alpha.3
10 years ago
2.0.0-alpha.2
10 years ago
2.0.0-alpha.1
10 years ago