Skip to content

litert/timezone.js

Repository files navigation

LiteRT/TimeZone

npm version License GitHub issues GitHub Releases

The timezone support library of LiteRT.

Copyright: This is just a toolset of timezone operation for JavaScript. As all timezone data is extracted from WikiPedia.

Requirements

  • TypeScript v3.1.x (Or newer)

Installation

npm i @litert/timezone --save

Usage

import TZ from "@litert/timezone";

console.log(TZ.findByName("Asia/Brunei")); // Find the info of timezone Asia/Brunei.

console.log(TZ.findByLocation("US")); // Find the list of timezone used by US.

console.log(TZ.findByOffset(480)); // Find the list of timezones whose offset is 480 (from UTC, ini).

console.log(TZ.findByDSTOffset(480)); // Find the list of timezones whose DST offset is 480.

console.log(TZ.findCanonicalList()); // Find out list of all canonical timezone.

console.log(TZ.offsetToString(480)); // Convert minute offset into string, which should be +08:00.

console.log(TZ.offsetFromString('-08:00')); // Convert a string into minute offset, which should be -480.

Documents

Preparing yet.

License

This library is published under Apache-2.0 license.