@phensley/timezone
Advanced tools
Comparing version 1.0.7 to 1.0.8
{ | ||
"name": "@phensley/timezone", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "Compact timezone lib based on tz database", | ||
@@ -40,11 +40,11 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@phensley/cldr-utils": "1.0.7", | ||
"tslib": "1.11.1" | ||
"@phensley/cldr-utils": "1.0.8", | ||
"tslib": "^1.11.1" | ||
}, | ||
"devDependencies": { | ||
"@microsoft/api-extractor": "^7.7.8", | ||
"@types/jest": "25.1.3", | ||
"@types/node": "^10.14.10", | ||
"@types/jest": "^25.1.3", | ||
"@types/node": "^13.9.2", | ||
"@types/rimraf": "^2.0.2", | ||
"@types/yargs": "13.0.3", | ||
"@types/yargs": "^13.0.3", | ||
"beautify-benchmark": "^0.2.4", | ||
@@ -54,11 +54,11 @@ "benchmark": "^2.1.4", | ||
"dts-bundle-generator": "^3.1.0", | ||
"jest": "25.1.0", | ||
"jest": "^25.1.0", | ||
"rimraf": "^3.0.0", | ||
"ts-jest": "25.2.1", | ||
"ts-jest": "^25.2.1", | ||
"ts-node": "^8.3.0", | ||
"tslint": "^5.18.0", | ||
"tslint": "^6.1.0", | ||
"tslint-no-circular-imports": "^0.7.0", | ||
"typescript": "3.8.x", | ||
"typescript": "^3.8.x", | ||
"uglify-es": "^3.3.9", | ||
"yargs": "14.2.0" | ||
"yargs": "^14.2.0" | ||
}, | ||
@@ -82,3 +82,3 @@ "jest": { | ||
}, | ||
"gitHead": "f411d4925d2d57589ef2cd9f1c13ef6871224bc3" | ||
"gitHead": "42451ff35e9b5e3abeb04d2fd71ae0fc0639a82a" | ||
} |
@@ -1,4 +0,62 @@ | ||
[`@phensley/timezone`](https://www.npmjs.com/package/@phensley/timezone) ![min+gzip](https://badgen.net/bundlephobia/minzip/@phensley/timezone) | ||
# @phensley/timezone | ||
Compact timezone library provides the full range of tzdb data. | ||
https://data.iana.org/time-zones/tz-link.html | ||
[![@phensley/timezone](https://badge.fury.io/js/%40phensley%2Ftimezone.svg)](https://www.npmjs.com/package/@phensley/timezone) [![min+gzip](https://badgen.net/bundlephobia/minzip/@phensley/timezone)](https://bundlephobia.com/result?p=@phensley/timezone) | ||
Compact timezone library provides the full range of tzdb data. Supports all years for which rules exist, with currently-active rules extended into the future through year 2499. https://data.iana.org/time-zones/tz-link.html | ||
## Installation | ||
NPM: | ||
``` | ||
npm install --save @phensley/timezone | ||
``` | ||
Yarn: | ||
``` | ||
yarn add @phensley/timezone | ||
``` | ||
## Examples | ||
Resolve old timezone ids that are deprecated. | ||
```typescript | ||
import { TZ } from '@phensley/timezone'; | ||
const id = TZ.resolveId('Pacific/Samoa'); | ||
console.log(id); | ||
``` | ||
``` | ||
Pacific/Pago_Pago | ||
``` | ||
Lookup the zone info for a timezone id at a given UTC time. Timezone offsets are in milliseconds. | ||
```typescript | ||
const ZONES = [ | ||
'UTC', | ||
'Pacific/Samoa', | ||
'America/New_York', | ||
'Pacific/Pago_Pago', | ||
'Asia/Tokyo', | ||
'Europe/Paris' | ||
]; | ||
const now = new Date(2020, 2, 18, 12, 30, 0).getTime(); | ||
for (const zoneid of ZONES) { | ||
const info = TZ.fromUTC(zoneid, now); | ||
console.log(`${zoneid.padEnd(18)} -> ${JSON.stringify(info)}`); | ||
} | ||
``` | ||
``` | ||
UTC -> {"abbr":"UTC","dst":0,"offset":0,"zoneid":"Etc/UTC"} | ||
Pacific/Samoa -> {"abbr":"SST","dst":0,"offset":-39600000,"zoneid":"Pacific/Pago_Pago"} | ||
America/New_York -> {"abbr":"EDT","dst":1,"offset":-14400000,"zoneid":"America/New_York"} | ||
Pacific/Pago_Pago -> {"abbr":"SST","dst":0,"offset":-39600000,"zoneid":"Pacific/Pago_Pago"} | ||
Asia/Tokyo -> {"abbr":"JST","dst":0,"offset":32400000,"zoneid":"Asia/Tokyo"} | ||
Europe/Paris -> {"abbr":"CET","dst":0,"offset":3600000,"zoneid":"Europe/Paris"} | ||
``` |
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
331484
63
+ Added@phensley/cldr-utils@1.0.8(transitive)
+ Addedtslib@1.14.1(transitive)
- Removed@phensley/cldr-utils@1.0.7(transitive)
- Removedtslib@1.11.1(transitive)
Updated@phensley/cldr-utils@1.0.8
Updatedtslib@^1.11.1