New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

generate-timezone-json

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

generate-timezone-json - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

2

package.json
{
"name": "generate-timezone-json",
"version": "0.2.3",
"version": "0.2.4",
"bin": "./index.js",

@@ -5,0 +5,0 @@ "description": "Generate JSON file containing timezones from a tab file or the official IANA database",

@@ -1,2 +0,2 @@

# Generate Timezone JSON
# Generate Time Zone JSON

@@ -10,20 +10,37 @@ [![npm](https://img.shields.io/npm/v/generate-timezone-json)](https://www.npmjs.com/package/generate-timezone-json)

### Installation
Run `npm i generate-timezone-json` to install in your current node project
*Please report issues found or suggestions in the [project issues page](https://github.com/ayoayco/generate-timezone-json/issues)*
or install globally with `npm i -g generate-timezone-json`
**Use cases where you may need this script:**
1. you need to sync the time zones information in your frontend app with a tab file (i.e. tab-seperated values), which is commonly used in servers
1. you need to have a dropdown/combobox with the latest time zones in your web application
1. you have a server-side function that needs information related to a location/time zone
### Usage
**Recommendation:** For performance, I recommend you don't generate the JSON file multiple times in run time. Determine a single point in your app/system's life cycle when it is best to do this (e.g., pre-build time or once when requested for the first time).
1. Run: `npx generate-timezone-json` to generate timezones.json from official IANA Database,
- this will generate a file named "timezones.json" with data coming from the official IANA database
1. Run: `npx generate-timezone-json <filename>` to generate timezones.json from a TAB file,
**Requirement:** This is a lightweight node.js script, and only requires that you have [node](https://nodejs.org/en/download/) installed.
### Usage (without installation)
Running the following will automatically download and cache the latest version, so there is no need to permanently install anything.
- `npx generate-timezone-json` to generate timezones.json from official IANA Database
- `npx generate-timezone-json <filename>` to generate timezones.json from a TAB file,
- for example, using a file named "zone.tab": `generate-timezone-json zone.tab`
If installed globally, the `npx` is optional.
*Important Note:* Currently, the structure of the generated JSON file will be different depending on the source (i.e, zone.tab or the IANA time zones database). This will be addressed in [this github issue](https://github.com/ayoayco/generate-timezone-json/issues/1).
*Important Note:* the structure of the generated JSON file will be different depending on the source (i.e, zone.tab or the IANA timezones database)
### Installation with NPM
If you have a need to permanently install the package do the following:
- Install locally: `npm i generate-timezone-json`
- Install globally: `npm i -g generate-timezone-json`
After installation, you can use `npx generate-timezone-json`.
### Download from Github
You can also download [the latest releases in Github](https://github.com/ayoayco/generate-timezone-json/releases). After downloading, extract the package, and run the unpacked JS script it with node: `node index.js`.
### Other options
This package is specifically useful if you need a JSON file with time zones information. I did not find anything like it but it uses a couple of other packages under the hood. The following may be more appropriate for you:
1. [@vvo/tzdb](https://github.com/vvo/tzdb) - a feature-packed time zones library that automatically releases updates when official time zones are changed
2. [shinnn/parse-zonetab](https://github.com/shinnn/parse-zonetab) - a lightweight parser of zone.tab files
### Planned features (not yet implemented)
1. Specify an output directory with option `--outDir`: `generate-timezone <filename> --outDir <directory>`

@@ -30,0 +47,0 @@ 2. Uniform JSON structure for all sources

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc