mapbox / timespace Goto Github PK
View Code? Open in Web Editor NEWcompute fuzzy local time from a location
License: MIT License
compute fuzzy local time from a location
License: MIT License
The current timezone.json lookup table is missing 53/104/8 tile because turf.intersect between America/Chicago zone and 53/104/8 tile fails with the following error:
unable to assign hole to a shell [ (-105.22637, 30.79939) ]
@mapbox/timespace version: 2.0.4
browser: Chrome Version 81.0.4044.138 (64-bit)
Open the sandbox example with link below
https://codesandbox.io/s/mapboxtimespace-example-evu15?file=/src/App.js
import React from "react";
import "./styles.css";
import mapTimeZone from "@mapbox/timespace";
const LOCATION = {
lat: 35.137396,
lng: -114.525379,
name: "Bullhead City, Arizona"
};
const getLocationTimeZone = ({ lat, lng }) => {
const currentTime = Date.now();
const locationTime = mapTimeZone.getFuzzyLocalTimeFromPoint(currentTime, [
lng,
lat
]);
return locationTime.tz();
};
export default function App() {
return (
<div className="App">
<div>Location - {LOCATION.lat}, {LOCATION.lng}</div>
<div>Place - {LOCATION.name}</div>
<div>Zone name - {getLocationTimeZone(LOCATION)}</div>
</div>
);
}
Zone name for this location is expected to be America/Phoenix
(MST)
Zone name as interpreted by the library is America/Los_Angeles
(PDT)
I have verified the timezone at this location lat: 35.137396, lng: -114.525379
with Google Timezone API and various other online sources, which also support the observation.
We should regenerate data from here (instead of my gist): http://efele.net/maps/tz/
cc @lily-chai
@tcql flagged that the coast of Texas/Louisiana is missing (e.g. 58/107/8, 60/106/8, 65/105/8).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.