Setting Default Month causes UTC Timezone to not work #2522
Answered
by
gpbl
romerorisa
asked this question in
Support
-
Beta Was this translation helpful? Give feedback.
Answered by
gpbl
Oct 11, 2024
Replies: 1 comment
-
@romerorisa When working with timezones, you should use https://daypicker.dev/docs/time-zone#working-with-time-zoned-dates - import { DayPicker } from 'react-day-picker';
+ import { DayPicker, TZDate } from 'react-day-picker';
<DayPicker
mode='single'
timeZone='UTC'
captionLayout='dropdown'
- selected={new Date(Date.parse(selectValue))}
+ selected={new TZDate(year, month, day, timezone)}
/> Please note that https://date-fns.org/v4.1.0/docs/Time-Zones#working-with-time-zones |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
gpbl
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@romerorisa When working with timezones, you should use
TZDate
instead ofDate
:https://daypicker.dev/docs/time-zone#working-with-time-zoned-dates
Please note that
TZDate
initializer is different fromDate
:https://date-fns.org/v4.1.0/docs/Time-Zones#working-with-time-zones