Summary
Profile and streak calculations currently derive day keys from toISOString(), which uses UTC rather than the learner's local day.
Problem
src/pages/profileProgressSummary.ts truncates date.toISOString() to YYYY-MM-DD. That shifts late-evening local activity into the next day for users west of UTC, and can shift early-morning activity for users east of UTC.
Impact
"Today", daily summaries, and streak calculations can be wrong even when the raw attempt timestamps are correct.
Relevant code
src/pages/profileProgressSummary.ts:24-25
- other call sites using the same UTC truncation pattern
Expected behavior
Day-based reporting should use the user's local day, or an explicitly chosen application timezone.
Suggested direction
- Introduce a single helper for date-key generation based on local calendar dates.
- Replace direct
toISOString().split('T')[0] usage in profile and streak code.
- Add tests around boundary times near local midnight.
Summary
Profile and streak calculations currently derive day keys from
toISOString(), which uses UTC rather than the learner's local day.Problem
src/pages/profileProgressSummary.tstruncatesdate.toISOString()toYYYY-MM-DD. That shifts late-evening local activity into the next day for users west of UTC, and can shift early-morning activity for users east of UTC.Impact
"Today", daily summaries, and streak calculations can be wrong even when the raw attempt timestamps are correct.
Relevant code
src/pages/profileProgressSummary.ts:24-25Expected behavior
Day-based reporting should use the user's local day, or an explicitly chosen application timezone.
Suggested direction
toISOString().split('T')[0]usage in profile and streak code.