Skip to content

Conversation

@gpbl
Copy link
Owner

@gpbl gpbl commented Nov 20, 2025

This PR fixes the bug reported by @lovebuizel in #2833, where the dates passed to the modifiers are not converted into the proper time-zone set via the timeZone prop.

To fix the bug, I first reproduced it with Jest. I added a test:tz npm script that runs tests under Australia/Adelaide (GMT+1100) and a regression in examples/timezone/TestCase2833.test.tsx where the desired timezone is 12 hours behind, e.g. Etc/GMT+12, to hit the “current date differs from timezone date” case.

After seeing the failure, I added convertMatchersToTimeZone and toTimeZone utilities to ensure all dates in modifier matchers (modifiers, disabled, hidden) are converted to the requested timeZone inside DayPicker. toTimeZone also checks whether incoming dates are already time-zoned, which should also help with the performance issues discussed in #2845.

@gpbl gpbl changed the title tests: add test case for #2833 fix: modifiers are not respecting the timezone Nov 20, 2025
@gpbl gpbl changed the title fix: modifiers are not respecting the timezone fix: ensure modifiers honor the timeZone prop Nov 20, 2025
@gpbl gpbl marked this pull request as ready for review November 20, 2025 10:38
@gpbl gpbl mentioned this pull request Nov 20, 2025
4 tasks
@gpbl gpbl merged commit 818581d into main Nov 21, 2025
20 checks passed
@gpbl gpbl deleted the gpbl/timezone-tests branch November 21, 2025 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants