determine a timezone from a lat/lng
npm install spacetime-geonpm install spacetime-geospacetime plugin for determining a timezone based on a point on the earth, and vice-versa.
this is really just a wrapper of tz-lookup by dark-sky - based on Evan Siroky's awesome boundary-builder work.
``js
import spacetime from './src/index'
import geo from 'spacetime-geo'
//apply the plugin
spacetime.extend(geo)
//set a specific time somewhere
let s = spacetime('June 4 2018', 'Canada/Eastern').time('3:37pm')
//where is this timezone? (approx)
s.point()
//{ lat: 43.65, lng: -79.38 }
//go to a specific point (near paris)
s.in([48.7235, 1.9931])
s.timezone().name
//Europe/Paris
s.time()
//9:37pm
`
in the browser: 111kb (uncompressed)`html`
spacetime-geo accepts other formats of geolocation too:
`js`
spacetime.now().in({lat:42.7235, lon:-73.6931})
spacetime.now().in('48.7235, 1.9931')
!1091
You can always produce a more-detailed, and larger (<=130mb!) dataset using Evan Siroky's script.
MIT