Skip to content

[Bug]: Fix streak calculation by using user timezone instead of UTC dates#536

Merged
indresh404 merged 3 commits into
indresh404:mainfrom
kunal-yelgate:Bug/time
Jun 15, 2026
Merged

[Bug]: Fix streak calculation by using user timezone instead of UTC dates#536
indresh404 merged 3 commits into
indresh404:mainfrom
kunal-yelgate:Bug/time

Conversation

@kunal-yelgate

Copy link
Copy Markdown
Contributor

GitHub records contribution activity using UTC timestamps, while RankerHub users view activity according to their local timezone.

Example

  • User Timezone: Asia/Kolkata (UTC+5:30)
  • Contribution Time: 11:55 PM (Local Time)
  • GitHub Timestamp: 06:25 PM UTC

When streak calculations use UTC dates directly, contributions may be attributed to a different calendar day than the user expects, causing valid streaks to appear broken.

Changes

  • Store and use the user's timezone during streak calculations.
  • Convert GitHub contribution timestamps to the user's local timezone before evaluating daily activity.
  • Base streak validation on local calendar days instead of raw UTC dates.
  • Add test coverage for timezone conversions and day-boundary edge cases.

Impact

Before

  • Users could lose streaks incorrectly.
  • Daily contribution counts could be inaccurate.
  • Users outside UTC were disproportionately affected.

After

  • Streak calculations respect the user's local timezone.
  • Contributions near midnight are assigned to the correct local day.
  • Streaks remain consistent with GitHub contribution activity.
  • Improved accuracy and trust in contribution tracking.

Acceptance Criteria

  • Streak calculations use the user's local timezone.
  • Contributions near midnight are assigned to the correct local day.
  • Streaks remain consistent with GitHub contribution activity.
  • Tests added for timezone and day-boundary scenarios.

Fixes

Fixes #505

@vercel

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ranker-hub Ready Ready Preview, Comment Jun 15, 2026 9:32am

@github-actions github-actions Bot added bug Something isn't working enhancement New feature or request frontend Frontend related changes (HTML/CSS/JS/React) gssoc GirlScript Summer of Code gssoc26 GirlScript Summer of Code 2026 nsoc NSoC NSoC'26 NSoC 2026 pending-review PR is pending review labels Jun 15, 2026
Combine timezone-aware streak day calculation with Math.max guard from main to restore lint and build CI.

Co-authored-by: Cursor <cursoragent@cursor.com>
@kunal-yelgate

Copy link
Copy Markdown
Contributor Author

Hey @indresh404 review the PR

@indresh404 indresh404 merged commit dc725fd into indresh404:main Jun 15, 2026
18 checks passed
@kunal-yelgate kunal-yelgate deleted the Bug/time branch June 15, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request frontend Frontend related changes (HTML/CSS/JS/React) gssoc GirlScript Summer of Code gssoc26 GirlScript Summer of Code 2026 level3 nsoc NSoC NSoC'26 NSoC 2026 pending-review PR is pending review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Timezone Differences Cause Incorrect Streak Breaks Despite Valid GitHub Contributions

2 participants