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
[BUG] Streak uses the UTC date instead of the user's local date #116
updateStreak in src/utils/stats.ts computes "today" and "yesterday" from new Date().toISOString(), which gives the UTC calendar date. The rest of the planner (week ids, days) uses the local date (src/types/weekUtils.ts).
For users outside UTC, activity near midnight is recorded on the wrong day:
In UTC+2 (e.g. Central Europe in summer), completing a block at 00:30 local time on Tuesday stores lastActiveDate as Monday.
Two activities at 23:30 Monday and 00:30 Tuesday local time can land on the same UTC date, so the streak is not incremented even though the user was active on two consecutive local days.
West of UTC the opposite happens in the evening.
Steps to reproduce
Set the device timezone to UTC+2.
Complete a block at 00:30 local time.
lastActiveDate (AsyncStorage @levelup/last_active) holds the previous day's date.
Expected behavior
Streak days follow the user's local calendar, consistent with the planner weeks.
Suggested fix
Build the date string from local fields (getFullYear(), getMonth(), getDate()), as getWeekId already does, and compute "yesterday" the same way. Existing users' stored lastActiveDate values stay valid (same YYYY-MM-DD format).
Found while writing tests; drafted with the help of Claude Code.
Activity