fix: parse holiday date strings as local time to prevent timezone shift#6106
Merged
martijnrusschen merged 1 commit intomainfrom Dec 5, 2025
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6106 +/- ##
=======================================
Coverage 99.23% 99.23%
=======================================
Files 30 30
Lines 3649 3649
Branches 1578 1574 -4
=======================================
Hits 3621 3621
Misses 27 27
Partials 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
When holiday dates are provided as ISO date strings (YYYY-MM-DD), the previous implementation used `new Date(string)` which parses them as UTC midnight. This caused holidays to display on the wrong day in timezones west of UTC. For example, "2025-01-01" would be parsed as 2025-01-01T00:00:00.000Z, which when formatted in PST (UTC-8) becomes December 31st, 2024. This fix uses the existing `parseDate` utility with the ISO format, which uses date-fns's `parse` function that treats dates as local time. Fixes #6105 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
e38175f to
f7c928e
Compare
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.
Summary
Fixes #6105
This PR fixes a bug where holidays specified as ISO date strings (e.g.,
"2025-01-01") would display on the wrong day in timezones west of UTC.The Problem
When holiday dates are provided as ISO date strings (
YYYY-MM-DD), the previous implementation usednew Date(string)to parse them. Per JavaScript specification, ISO date strings without a time component are parsed as UTC midnight.Later, when the date is formatted using
date-fns'sformat()function, it converts the date to the local timezone. This causes the date to shift backward by one day for users in timezones west of UTC.Example of the bug:
"2025-01-01"2025-01-01T00:00:00.000Z(UTC midnight)2024-12-31T16:00:00.000-08:00The Fix
The fix uses the existing
parseDateutility function with the"yyyy-MM-dd"format. This leveragesdate-fns'sparsefunction which treats the date string as local time rather than UTC, ensuring holidays display on the intended date regardless of timezone.Before:
After: