Package Exports
- date-from-timezone
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (date-from-timezone) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
date-from-timezone
Construct dates with timezone context
Having timezone and date & time information resolve regular date instance that reflects given time point.
Light implementation which resolves needed data through natively available (in all modern engines, both browsers and Node.js) Intl.DateTimeFormat.
If loaded in environment which does not provide Intl.DateTimeFormat or of which support is incomplete, module resolves to null
Example
var dateFromTimezone = require("date-from-timezone");
var getWarsawDate = dateFromTimezone("Europe/Warsaw");
var getShanghaiDate = dateFromTimezone("Asia/Shanghai");
// Signature of getXDate follows: Date(year, month[, date[, hour[, minutes[, seconds[, milliseconds]]]]])
var warsawNoon = getWarsawDate(2017, 6, 5, 12);
var shanghaiNoon = getShanghaiDate(2017, 6, 5, 12);
console.log(warsawNoon.toISOString()); // "2017-07-05T10:00:00.000Z" (12PM in Warsaw was at 10AM UTC)
console.log(shanghaiNoon.toISOString()); // "2017-07-05T04:00:00.000Z" (12PM in Shanghai was at 4AM UTC)Installation
$ npm install date-from-timezoneTests
$ npm testProject cross-browser compatibility supported by:
