Skip to content

Commit

Permalink
Adds functionality to get timezone abbreviations only (#249)
Browse files Browse the repository at this point in the history
  • Loading branch information
suryarajendhran authored Mar 4, 2022
1 parent 245a8ad commit 6ab28f7
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ npm add @vvo/tzdb
Usage:

```js
import { getTimeZones, rawTimeZones, timeZonesNames } from "@vvo/tzdb";
import { getTimeZones, rawTimeZones, timeZonesNames, abbreviations } from "@vvo/tzdb";
```

## API
Expand Down Expand Up @@ -134,6 +134,35 @@ This is an array of time zone names:
];
```

### abbreviations

This is an object mapping timezone abbreviations to their full forms:

```js
{
// ...
"Australian Central Daylight Time": "ACDT",
"Australian Central Standard Time": "ACST",
"Australian Central Time": "ACT",
"Australian Central Western Standard Time": "ACWST",
"Australian Eastern Daylight Time": "AEDT",
"Australian Eastern Standard Time": "AEST",
"Australian Eastern Time": "AET",
"Australian Western Daylight Time": "AWDT",
"Australian Western Standard Time": "AWST",
"Azerbaijan Summer Time": "AZST",
"Azerbaijan Time": "AZT",
"Azores Summer Time": "AZOST",
"Azores Time": "AZOT",
"Bangladesh Standard Time": "BST",
"Bhutan Time": "BTT",
"Bolivia Time": "BOT",
// ...
};
```

**Caution:** Although abbreviations can be easy to lookup, they can be misleading. For example: CST can refer to Central Standard Time (-06.00 UTC), China Standard Time (+06.00 UTC) or Cuba Standard Time (-05.00 UTC). And abbreviation full forms don't directly map to any property in the time zone objects returned by `rawTimeZones` or `getTimeZones()`.

## Notes

- We provide two cities when grouping happens, ranked by population
Expand Down
1 change: 1 addition & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { default as rawTimeZones } from "../raw-time-zones.json";
export { default as timeZonesNames } from "../time-zones-names.json";
export { default as getTimeZones } from "./getTimeZones.js";
export { default as abbreviations } from "../abbreviations.json";
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"dist/",
"lib/",
"time-zones-names.json",
"abbreviations.json",
"raw-time-zones.json",
"LICENSE",
"README.md",
Expand Down

0 comments on commit 6ab28f7

Please sign in to comment.