timezone-id

1.0.15 • Public • Published

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
        })

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.1518latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.1518
1.0.140
1.0.130
1.0.120
1.0.110
1.0.100
1.0.90
1.0.80
1.0.70
1.0.60
1.0.50
1.0.40
1.0.30
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i timezone-id

Weekly Downloads

13

Version

1.0.15

License

ISC

Unpacked Size

10.9 kB

Total Files

10

Last publish

Collaborators

  • albertincx