fast time zone lookup
This is a little module that allows you to look up the current time zone of a
location, given it's latitude and longitude. I wrote it because the existing
Node module that does this (
tzwhere) was far too slow to be useful in a
production setting. This module attempts to ameliorate that.
npm install tz-lookup
> var tz = require("tz-lookup"); > console.log(tz(42.7235, -73.6931)); "America/New_York"
Please take note of the following:
If you find a real-world case where this module's accuracy is inadequate, please open an issue (or, better yet, submit a pull request with a failing test) and I'll see what I can do to increase the accuracy for you.
Timezone data is from Eric Muller's excellent TZ timezone maps. To
regenerate the compressed database, simply download his
convert it to a GeoJSON using GDAL, put it in the project directory (with the
tz_world.json), and run
json2bin >tz.bin. The timezone database was
last updated on 7 Nov 2015.
To the extend possible by law, The Dark Sky Company, LLC has waived all copyright and related or neighboring rights to this library.