🕰 Simplified, grouped and always up to date list of time zones, with major cities
Installations
npm install @vvo/tzdb
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
18.20.5
NPM Version
10.8.2
Score
99.6
Supply Chain
99.6
Quality
94.7
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
vvo
Download Statistics
Total Downloads
15,236,570
Last Day
29,189
Last Week
138,455
Last Month
584,116
Last Year
6,496,658
GitHub Statistics
809 Stars
542 Commits
55 Forks
6 Watching
21 Branches
12 Contributors
Bundle Size
132.36 kB
Minified
26.30 kB
Minified + Gzipped
Package Meta Information
Latest Version
6.159.0
Package Id
@vvo/tzdb@6.159.0
Unpacked Size
170.36 kB
Size
37.47 kB
File Count
20
NPM Version
10.8.2
Node Version
18.20.5
Publised On
17 Jan 2025
Total Downloads
Cumulative downloads
Total Downloads
15,236,570
Last day
-12.1%
29,189
Compared to previous day
Last week
-12.7%
138,455
Compared to previous week
Last month
10.5%
584,116
Compared to previous month
Last year
46.4%
6,496,658
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
tzdb
This is a list and npm package of:
- "simplified" IANA time zones with their alternative names like
Pacific Time
instead ofAmerica/Los_Angeles
, along with major cities for each time zone. - all existing raw IANA time zones names
- "raw" offsets along with current time offsets
- also includes deprecated time zone names for compatibility
The data and npm packages are automatically updated whenever there are changes to https://www.geonames.org/ which is generated from IANA databases.
This is useful whenever you want to build a time zone select menu in your application.
NPM package
Installation:
1npm add @vvo/tzdb
Usage:
1import { getTimeZones, rawTimeZones, timeZonesNames, abbreviations } from "@vvo/tzdb";
API
getTimeZones()
1const timeZones = getTimeZones(); 2 3// You can also provide an optional parameter to include UTC in the result. 4// This adds a time zone with the name "UTC" and a fixed offset of 0. 5const timeZonesWithUtc = getTimeZones({ includeUtc: true });
This method returns an array of time zones objects:
1[ 2 // ... 3 { 4 name: "America/Los_Angeles", 5 alternativeName: "Pacific Time", 6 group: ["America/Los_Angeles"], 7 continentCode: "NA", 8 continentName: "North America", 9 countryName: "United States", 10 countryCode: "US", 11 mainCities: ["Los Angeles", "San Diego", "San Jose", "San Francisco"], 12 rawOffsetInMinutes: -480, 13 abbreviation: "PST", 14 rawFormat: "-08:00 Pacific Time - Los Angeles, San Diego, San Jose, San Francisco", 15 currentTimeOffsetInMinutes: -420, // "current" time zone offset, this is why getTimeZones() is a method and not just an object: it works at runtime 16 currentTimeFormat: "-07:00 Pacific Time - Los Angeles, San Diego", 17 }, 18 // ... 19];
When relevant, time zones are grouped. The rules for grouping are:
- if the time zones are in the same country
- if the DST or summer time offsets are the same
- if the non-DST, non-summer time offsets are the same
- then we group the time zones
- the "main" time zone name (
name
attribute), is always the one from the most populated city
Here's a grouping example:
1{ 2 name: "America/Dawson_Creek", 3 alternativeName: "Mountain Time", 4 group: ["America/Creston", "America/Dawson_Creek", "America/Fort_Nelson"], 5 continentCode: "NA", 6 continentName: "North America", 7 countryName: "Canada", 8 countryCode: "CA", 9 mainCities: ["Fort St. John", "Creston", "Fort Nelson"], 10 rawOffsetInMinutes: -420, 11 abbreviation: "MST", 12 rawFormat: "-07:00 Mountain Time - Fort St. John, Creston, Fort Nelson", 13 currentTimeOffsetInMinutes: -420, 14 currentTimeFormat: "-07:00 Mountain Time - Fort St. John, Creston" 15}
rawTimeZones
This is an array of time zone objects without the current time information:
1[ 2 // ... 3 { 4 name: "America/Los_Angeles", 5 alternativeName: "Pacific Time", 6 group: ["America/Los_Angeles"], 7 continentCode: "NA", 8 continentName: "North America", 9 countryName: "United States", 10 countryCode: "US", 11 mainCities: ["Los Angeles", "San Diego", "San Jose", "San Francisco"], 12 rawOffsetInMinutes: -480, 13 abbreviation: "PST", 14 rawFormat: "-08:00 Pacific Time - Los Angeles, San Diego, San Jose, San Francisco", 15 }, 16 // ... 17];
timeZonesNames
This is an array of time zone names:
1[ 2 // ... 3 "America/Juneau", 4 "America/Kentucky/Louisville", 5 "America/Kentucky/Monticello", 6 "America/Kralendijk", 7 "America/La_Paz", 8 "America/Lima", 9 "America/Los_Angeles", 10 "America/Lower_Princes", 11 "America/Maceio", 12 "America/Managua", 13 "America/Manaus", 14 "America/Marigot", 15 "America/Martinique", 16 "America/Matamoros", 17 // ... 18];
abbreviations
This is an object mapping timezone abbreviations to their full forms:
1{ 2 // ... 3 "Australian Central Daylight Time": "ACDT", 4 "Australian Central Standard Time": "ACST", 5 "Australian Central Time": "ACT", 6 "Australian Central Western Standard Time": "ACWST", 7 "Australian Eastern Daylight Time": "AEDT", 8 "Australian Eastern Standard Time": "AEST", 9 "Australian Eastern Time": "AET", 10 "Australian Western Daylight Time": "AWDT", 11 "Australian Western Standard Time": "AWST", 12 "Azerbaijan Summer Time": "AZST", 13 "Azerbaijan Time": "AZT", 14 "Azores Summer Time": "AZOST", 15 "Azores Time": "AZOT", 16 "Bangladesh Standard Time": "BST", 17 "Bhutan Time": "BTT", 18 "Bolivia Time": "BOT", 19 // ... 20};
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
- We provide alternative names ("Pacific Time" for "America/Los_Angeles") and remove "Standard", "Daylight" or "Summer" from them
- If you're using this to build a time zone selector and saving to a database then:
- make sure to save the
name
attribute (America/Los_Angeles
) in your database - when displaying the select with a default value from your database, either select the time zone name that matches, or if the time zone name is part of the group. Example:
- make sure to save the
1const value = timeZones.find((timeZone) => { 2 return dbData.timeZone === timeZone.name || timeZone.group.includes(dbData.timeZone); 3});
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
packaging workflow detected
Details
- Info: Project packages its releases by way of GitHub Actions.: .github/workflows/maybe-release.yml:12
Reason
10 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 8
Reason
dependency not pinned by hash detected -- score normalized to 5
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/CI.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/vvo/tzdb/CI.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/CI.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/vvo/tzdb/CI.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/CI.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/vvo/tzdb/CI.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/maybe-release.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/vvo/tzdb/maybe-release.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/maybe-release.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/vvo/tzdb/maybe-release.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/maybe-release.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/vvo/tzdb/maybe-release.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/maybe-release.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/vvo/tzdb/maybe-release.yml/main?enable=pin
- Info: 0 out of 6 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
- Info: 2 out of 2 npmCommand dependencies pinned
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/CI.yml:1
- Warn: no topLevel permission defined: .github/workflows/maybe-release.yml:1
- Info: no jobLevel write permissions found
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Reason
39 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97
- Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j
- Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695
- Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm
- Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574
- Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-3xq5-wjfh-ppjc
- Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj
- Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g
- Warn: Project is vulnerable to: GHSA-hj9c-8jmm-8c52
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-x2pg-mjhr-2m5x
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-4x5v-gmq8-25ch
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-v2p6-4mp7-3r9v
- Warn: Project is vulnerable to: GHSA-qgmg-gppg-76g5
- Warn: Project is vulnerable to: GHSA-xx4c-jj58-r7x6
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
Score
3.9
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More