timezone-id
v1.0.15
Published
asynchronous interface for getting timezone by city name or coords
Downloads
96
Readme
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:
- https://geocode-maps.yandex.ru/1.x/?geocode=[city]&format=json&results=1
- https://api.teleport.org/api/locations/[coordinates]/?embed=location:nearest-cities/location:nearest-city/city:timezone
Requirements
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
})