-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Labels
HacktoberfestSimple issues suitable Hacktoberfest PRsSimple issues suitable Hacktoberfest PRsbugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomersjavascriptJavascript knowledge neededJavascript knowledge needed
Description
Currently, the data auto update mechanism only works if the user has the same timezone than the official at Catalonia: CEST (with timelight.
https://github.com/emibcn/covid/blob/master/app/src/Backend/Maps/index.js#L132
// Calculates haw many milliseconds until next schedulled update (today's or tomorrow)
// TODO: Take care of timezones: Official date is in CEST/GMT+0200 (with daylight saving modifications), Date uses user's timezone and returns UTC
// Now, it only works if user timezone is CEST
// Probably, the best would be to translate both dates into UTC and, only then, compare them
millisToNextUpdate = () => {
const now = new Date();
const todayDataSchedule = new Date(now.getFullYear(), now.getMonth(), now.getDate(), ...this.officialUpdateTime, 0, 0);
const millisTillSchedulle = todayDataSchedule - now;
return millisTillSchedulle <= 0
? millisTillSchedulle + 86_400_000 // it's on or after today's schedule, try next schedule tomorrow.
: millisTillSchedulle
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
HacktoberfestSimple issues suitable Hacktoberfest PRsSimple issues suitable Hacktoberfest PRsbugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomersjavascriptJavascript knowledge neededJavascript knowledge needed