You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Daily step reset happens at UTC midnight instead of the user's local midnight #10
The daily auto-reset of steps/distance/calories fires at UTC midnight, not the user's local midnight. Any user not on UTC has their counters reset in the middle of the day.
Root cause
app.js:
functiontoday(){returnnewDate().toISOString().slice(0,10);}// toISOString() is UTC
load() then does the daily reset based on this UTC date:
Because toISOString() returns the UTC calendar date, the "new day" boundary is 00:00 UTC. For example, a US-Pacific user's steps reset around 16:00–17:00 their local time.
Expected
Counters reset at the user's local midnight.
Suggested fix
Compute the local date instead of the UTC date, e.g.:
(or new Date().toLocaleDateString('en-CA'), which yields YYYY-MM-DD in local time). lastReset is stored/compared with the same function, so only today() needs changing.
Activity