[BUG] [BUG/RFC] Commit Streak Reset and Metric Discrepancy Due to GitHub API ISO-8601 Timezone Offset Mismatches
Bug Description
Describe the Bug A major inconsistency occurs in the commit streak tracker and the contribution bar chart when a developer commits close to the boundary lines of their local midnight.
Because GitHub stores all event timestamps in UTC (YYYY-MM-DDTHH:MM:SSZ), fetching metrics via the GitHub API/Webhooks and parsing them on a Next.js server component without explicitly passing the user's client-side IANA timezone (Intl.DateTimeFormat().resolvedOptions().timeZone) causes commits to fall into the wrong calendar day. As a result, active commit streaks unexpectedly reset to 0, and the contribution graph displays metrics that mismatch the official GitHub profile page.
Steps to Reproduce
To Reproduce Set your local machine timezone to an extreme offset (e.g., UTC+05:30 or UTC-08:00).
Make a commit via GitHub at 11:30 PM (23:30) local time.
On GitHub's interface, this correctly records on Day X. However, in UTC, this event translates to Day X+1.
Sync or refresh the devtrack dashboard.
Observe the contribution bar chart and streak status.
Affected Area
Dashboard
Screenshots
none
Browser & OS
windows 11
Environment
None
Additional Context
Expected Behavior The contribution bar chart and streak counter should calculate dates dynamically relative to the authenticated user's profile/browser locale metadata, matching the exact chronological visual representation on their GitHub profile.
Actual Behavior The dashboard evaluates the raw UTC timestamps against server-side time (or hardcoded UTC assumptions), pushing late-night or early-morning commits into neighboring days. This creates phantom gaps in data, showing a missed day and destroying active contribution streaks.
Proposed Architecture / Solution (RFC) To guarantee precise metric aggregation across global timezones, we should refine the ingestion pipeline:
Capture Client Locale on Auth/Session: Store the user's localized time zone in the application context or Supabase profile table during user login/OAuth synchronization.
Date Truncation Layer (Day-boundary locking): Implement a utility function utilizing libraries like date-fns-tz to parse the incoming GitHub timestamp, shifting it cleanly into the developer’s local bounds before evaluating streak increments:
TypeScript import { utcToZonedTime, format } from 'date-fns-tz';
export function getDeveloperLocalDate(utcString: string, userTimeZone: string): string { const zonedDate = utcToZonedTime(new Date(utcString), userTimeZone); return format(zonedDate, 'yyyy-MM-dd', { timeZone: userTimeZone }); } Database Aggregation Check: Update the PostgreSQL schema/query tracking the streaks count to group contributions dynamically by the transformed local date rather than raw UTC timestamps.
Environment Details Framework: Next.js (App Router)
Database: Supabase (PostgreSQL)
Visual Components: Recharts
Tested Timezones: IST (UTC+5:30), PST (UTC-8)
Thanks for opening your first issue on DevTrack! 🎉
A maintainer will take a look shortly. In the meantime:
- Check the Contributing guide if you are planning to work on this
- Browse Discussions for Q&A and ideas
- Look for
good first issueif you want somewhere to start
If you find DevTrack useful, a ⭐ star on the repo is always appreciated — it helps the project reach more developers!
/assign
Hi @Priyanshu-byte-coder , I’d like to work on this issue. My approach is to convert GitHub UTC timestamps into the authenticated user's local timezone before performing streak and contribution calculations. This will ensure day boundaries match the user's GitHub profile and prevent incorrect streak resets caused by timezone differences. Approach: Get the user's timezone (Intl.DateTimeFormat().resolvedOptions().timeZone). Convert GitHub UTC timestamps to the user's local timezone using date-fns-tz. Extract the local date (yyyy-MM-dd) from the converted timestamp. Use the local date for streak calculations and contribution graph aggregation instead of raw UTC dates. Test with multiple timezones (IST, PST, UTC, etc.) to verify consistency with GitHub's contribution graph.
@Priyanshu-byte-coder I would like to work on this issue under GSSoC'26. Can you please assign this issue to me? I have mentioned my approach in the issue itself. Thanking you in advance.
Assigned to @toufiq00007! You have 7 days to open a PR. No PR after 7 days = auto-unassigned so others can pick it up. Good luck!
Hey @toufiq00007 — this issue was assigned 7 days ago with no PR opened. Unassigning so others can pick it up.
Still working on it? Drop a comment and request re-assignment.
Hey @thakurakanksha288 — this issue was assigned a while back with no recent activity. Unassigning so it's available for Hacktoberfest contributors. Still working on it? Comment and we'll reassign you.
Assigned to @Priyanshu-byte-coder! You have 7 days to open a PR. No PR after 7 days = auto-unassigned so others can pick it up. Good luck!
This issue has been inactive for 21 days. If you are still working on it or it is still relevant, please leave a comment — otherwise it will be closed in 7 days.