fix: correct date display by preventing timezone conversion#2
Open
matiasmoya wants to merge 1 commit intomariohamann:mainfrom
Open
fix: correct date display by preventing timezone conversion#2matiasmoya wants to merge 1 commit intomariohamann:mainfrom
matiasmoya wants to merge 1 commit intomariohamann:mainfrom
Conversation
Fixes #1 The toLocaleDateString() call was converting UTC dates to local timezone, causing dates to display one day earlier in timezones behind UTC. For example, if you're in a timezone behind UTC (like America/New_York, UTC-5), a UTC date of 2025-09-29 00:00:00 UTC becomes 2025-09-28 19:00:00 EST in local time, which then displays as 2025-09-28. Added timeZone: 'UTC' option to preserve the correct date.
mariohamann
reviewed
Oct 20, 2025
Comment on lines
+143
to
+148
| const text = `${currentDate.toLocaleString(lang, { | ||
| timeZone: 'UTC', | ||
| year: 'numeric', | ||
| month: '2-digit', | ||
| day: '2-digit' | ||
| })} – Activities: ${activityData[dateKey] || 0}`; |
Owner
There was a problem hiding this comment.
Suggested change
| const text = `${currentDate.toLocaleString(lang, { | |
| timeZone: 'UTC', | |
| year: 'numeric', | |
| month: '2-digit', | |
| day: '2-digit' | |
| })} – Activities: ${activityData[dateKey] || 0}`; | |
| const text = `${currentDate.toLocaleString(lang, { | |
| timeZone: 'UTC' | |
| })} – Activities: ${activityData[dateKey] || 0}`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes the date offset bug where activity graph tooltips (td title attribute) displayed dates one day before the actual activity data.
Closes #1
Problem
toLocaleDateString()method on line 143 was converting UTC dates to the user's local timezone, causing a date shift.For example, if you're in a timezone behind UTC (like America/New_York, UTC-5), a UTC date of 2025-09-29 00:00:00 UTC becomes 2025-09-28 19:00:00 EST in local time, which then displays as 2025-09-28.
Solution
Added
{ timeZone: 'UTC' }option totoLocaleDateString()to ensure dates are formatted in UTC and match the activity data keys.Changed
src/activity-graph-element.jsline 143Before
After
Testing
Tested in GMT-3 timezone: