JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 62
  • Score
    100M100P100Q68933F
  • License MIT

Construct dates with timezone context

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, returns regular date instance that corresponds do desired moment in time.

Light implementation that stands on supported in modern engines Intl.DateTimeFormat interface.

In environments that do not provide Intl.DateTimeFormat or of which support is incomplete module resolves to null

Example

var DateFromTimezone = require("./");

var dateFromWarsaw = new DateFromTimezone("Europe/Warsaw");
var warsawNoon = dateFromWarsaw.getDate(2017, 6, 5, 12);
console.log(warsawNoon.toISOString()); // "2017-07-05T10:00:00.000Z" (12PM in Warsaw was at 10AM in UTC)

var dateFromShanghai = new DateFromTimezone("Asia/Shanghai");
var shanghaiNoon = dateFromShanghai.getDate(2017, 6, 5, 12);
console.log(shanghaiNoon.toISOString()); // "2017-07-05T04:00:00.000Z" (12PM in Shanghai was at 4AM in UTC)

Installation

$ npm install date-from-timezone

Test

Project cross-browser compatibility supported by: