Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when timezone = utc, vuedatepicker selection of a day return the date of previous day at 23:59 #1036

Open
nathf80 opened this issue Nov 6, 2024 · 1 comment
Labels
awaiting triage The issue is not reviewed by the maintainers bug Something isn't working

Comments

@nathf80
Copy link

nathf80 commented Nov 6, 2024

The bug
vuedatepcker version: 10.0.0([email protected]([email protected]))

Action

When selecting a day of a month from date picker, with the following settings (with utc parameter) :

<VueDatePicker :model-value="parseModelValue" auto-apply :enable-time-picker="false" :timezone="utc" :month-picker="false" :week-picker="false" :year-picker="false" :year-range="yearRange" utc :min-date="minDateForDatePicker" :max-date="maxDateForDatePicker" :disabled="disabled" :locale="locale" :format="locale === 'fr' && (!isDay && !isMonth && !isWeek) ? 'dd/MM/yyyy' : ''" :input-class-name="disabled ? 'hover:cursor-not-allowed' : ''" @update:model-value="handleDate" />

Result

For exemple when selected from the calendar of VueDatePicker the 6th of November 2024,

The the value passed to handleDate is

With timezone current result expected result correct date translated in UTC
Europe/Paris 2024-11-06 22:59:59.999999 2024-11-06 22:59:59.999999
UTC 2024-11-05 23:59:59.999999 2024-11-06 23:59:59.999999 💥

We use version 10.0 of the library.

@nathf80 nathf80 added awaiting triage The issue is not reviewed by the maintainers bug Something isn't working labels Nov 6, 2024
@adamreisnz
Copy link

I think I ran into the same problem in v9 of the library. Adding the UTC flag shifted the whole day one day backwards. Ended up just working with the returned JS Date object and converting that to a Luxon DateTime first, then outputting in the formats we needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting triage The issue is not reviewed by the maintainers bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants