Skip to content

Use local dates instead of UTC day keys in profile and streak summaries #74

Description

@getOffIt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions