Skip to content

Fix inconsistent timezone handling in contributions API and StreakCalendar - #3237

Open
saurabhhhcodes wants to merge 2 commits into
Priyanshu-byte-coder:mainfrom
saurabhhhcodes:fix/devtrack-batch-1
Open

Fix inconsistent timezone handling in contributions API and StreakCalendar#3237
saurabhhhcodes wants to merge 2 commits into
Priyanshu-byte-coder:mainfrom
saurabhhhcodes:fix/devtrack-batch-1

Conversation

@saurabhhhcodes

Copy link
Copy Markdown
Contributor

Bug 1: Mixed timezone handling in contributions API route

fetchContributionsForAccount used toLocalDateStr() (local timezone) to format the since date for the GitHub API query, while every other route uses toISOString().slice(0, 10) (UTC). For users in negative UTC offsets this caused a one-day shift in the query window, making streak and contribution data disagree on which dates to include. Fixed by removing toLocalDateStr and using since.toISOString().slice(0, 10) consistently with the rest of the codebase.

Bug 2: StreakCalendar used local dates to look up UTC-keyed contribution data

The StreakCalendar component used toLocalDateStr() (local timezone) to construct the lookup key into the contribution data, but the data keys come from GitHub's API which always returns UTC dates (item.commit.author.date.slice(0, 10)). This caused commits to appear on wrong calendar cells for users whose local date differs from UTC. Fixed by renaming to toUtcDateStr and using toISOString().slice(0, 10) for both lookup and isToday comparison.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:bug GSSoC type bonus: bug fix labels Jul 25, 2026
@github-actions

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@github-actions github-actions Bot added type:feature GSSoC type bonus: new feature type:design GSSoC type bonus: UI/design (+10 pts) type:performance GSSoC type bonus: performance (+15 pts) labels Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc26 GSSoC 2026 contribution type:bug GSSoC type bonus: bug fix type:design GSSoC type bonus: UI/design (+10 pts) type:feature GSSoC type bonus: new feature type:performance GSSoC type bonus: performance (+15 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant