tzlookup
v1.4.0
Published
TZ Lookup based on binary array with grid of 0.1
Downloads
1,033
Readme
tzlookup
NodeJS Module for timezone lookup by geo location
Install
npm install tzlookup --save
Usage
const tz = require('tzlookup').tzNameAt;
console.log(tz(40.7092, -74.0151));
// => America/New_York
Also you can get all timezone names
var tzNames = require('tzlookup').tzNames;
console.log(tzNames.filter(function (name) { return /Europe/.test(name) }));
// => [ 'Europe/Amsterdam',
// 'Europe/Andorra',
// 'Europe/Athens',
// 'Europe/Belgrade',
// ...
API
tzNameAt(lat, lon)
lat
Required
Type: Number
Latitude – number between -90 and +90.
lon
Required
Type: Number
Longitude – number between -180 and +180.
Function with two arguments – latitude and longitude. Throws TypeError
if arguments is not a Number
and RangeError
if at least one of them is out of range.
tzNames
Returns the list of all known names of the timezones.
Lisense
MIT © Maxim Novikov