Skip to content

Commit ea9ecc0

Browse files
committed
fix: use local timezone for date grouping instead of UTC
The date formatters were using UTC timezone which caused usage data to be grouped incorrectly. For example, usage at 20:00 local time would appear on the next day if the local timezone was behind UTC. This regression was introduced in PR #409 (commit f7c5251) which added explicit UTC timezone to the Intl.DateTimeFormat configuration. The fix removes the hardcoded 'timeZone: UTC' option, allowing the formatters to respect the system's local timezone or the TZ environment variable if set. Changes: - Remove 'timeZone: UTC' from dateFormatter - Remove 'timeZone: UTC' from datePartsFormatter - Update comment to reflect local timezone usage This ensures usage data is grouped by the user's local date boundaries rather than UTC date boundaries.
1 parent 3165855 commit ea9ecc0

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/data-loader.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,10 +517,9 @@ function extractUniqueModels<T>(
517517

518518
/**
519519
* Date formatter using Intl.DateTimeFormat for consistent formatting
520-
* Using UTC to avoid timezone issues
520+
* Uses local timezone for proper date grouping
521521
*/
522522
const dateFormatter = new Intl.DateTimeFormat('en-CA', {
523-
timeZone: 'UTC',
524523
year: 'numeric',
525524
month: '2-digit',
526525
day: '2-digit',
@@ -541,7 +540,6 @@ export function formatDate(dateStr: string): string {
541540
* Date parts formatter for extracting year, month, and day separately
542541
*/
543542
const datePartsFormatter = new Intl.DateTimeFormat('en', {
544-
timeZone: 'UTC',
545543
year: 'numeric',
546544
month: '2-digit',
547545
day: '2-digit',

0 commit comments

Comments
 (0)