Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

timezone-id

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

timezone-id

asynchronous interface for getting timezone by city name or coords

  • 1.0.15
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

update: 01.01.2020

If you want to find tz by city name, you need to get the key for geocoder here

Description

timezone client module for node.js that provides an asynchronous interface for getting timezone by city name or coords. zone ID will be retrieved from here:

  1. https://geocode-maps.yandex.ru/1.x/?geocode=[city]&format=json&results=1
  2. https://api.teleport.org/api/locations/[coordinates]/?embed=location:nearest-cities/location:nearest-city/city:timezone

Requirements

  • node.js -- v0.8.0 or newer
  • API_KEY from here -- for city names

Install

npm install timezone-id

Examples

  • Get a timezone by city name:
  var tz = require('timezone-id');
  
  tz.getTimeZone('Sydney', API_KEY).then(timeZoneId => {
        console.log(timeZoneId); //Australia/Sydney
      })
  • Get a timezone by location coordinates:
  var tz = require('timezone-id');
    tz.getTimeZone([55.755814, 37.617635]).then(timeZoneId => {
          console.log(timeZoneId); //Asia/Tehran
        })

Keywords

FAQs

Package last updated on 18 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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