Description
Describe the bug
When the datepicker is initialized with a date that falls within DST, and the user then selects a date that falls outside of DST, the picker will incorrectly select one day early.
To Reproduce
Failing example (v11.0.2) – https://stackblitz.com/edit/vuepic-vue-datepicker-rxa4wute
Steps to reproduce the behavior:
- Change your local computer's timezone to
Pacific/Auckland
- Observe the date picker is initialized on 27-03-2025 (which is in DST in the specified timezone)
- Click on the date picker
- Select 27 DECEMBER 2025
- Observe that the date picks selects 26 DECEMBER 2025 instead
- Observe that the local reported date is
12/26/2025, 11:00:00 PM
instead of12/27/2025, 00:00:00
Expected behavior
The datepicker should select 27 DECEMBER 2025 when the user clicks on 27 DECEMBER 2025
I would personally expect that when not using the time picker, the dates returned would always return as a midnight timestamp on the selected date in the specified timezone.
If not using the timepicker, the user doesn't care about the time portion and is just interested in a date. So we should get the expected date in all circumstances, and not have it be dependent on what previous date was selected.
Edit: It seems this problem mainly occurs when your system timezone is not in the same timezone as the one you're testing with. However, Datepicker should respect the timezone provided as input prop.
Desktop & mobile (please complete the following information):
- Chrome
- 11.0.2