From 11b0bf9ecab53f096c8843cbc30b653bec6a2d01 Mon Sep 17 00:00:00 2001 From: Matt Hinczuk Date: Wed, 1 Oct 2025 23:34:05 -0300 Subject: [PATCH] fix: correct date display by preventing timezone conversion 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. --- src/activity-graph-element.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/activity-graph-element.js b/src/activity-graph-element.js index 901ffcf..aa045a6 100644 --- a/src/activity-graph-element.js +++ b/src/activity-graph-element.js @@ -140,9 +140,12 @@ export default function ActivityGraphElement({ const level = isDateInRange(currentDate) ? calculateActivityLevel(dateKey) : "disabled"; - const text = `${currentDate.toLocaleDateString(lang)} – Activities: ${ - activityData[dateKey] || 0 - }`; + const text = `${currentDate.toLocaleString(lang, { + timeZone: 'UTC', + year: 'numeric', + month: '2-digit', + day: '2-digit' + })} – Activities: ${activityData[dateKey] || 0}`; bodyRows[d].push( html` ${text}