Vuepic / vue-datepicker

Datepicker component for Vue 3
https://vue3datepicker.com
MIT License
1.38k stars 137 forks source link

min-date prop breaks v-model updating #919

Closed alexovn closed 3 days ago

alexovn commented 2 weeks ago

Describe the bug

https://github.com/Vuepic/vue-datepicker/assets/64487090/b0a7b2ac-7ca9-4a4f-97b8-5d0e5eaddd4b

When you try to use range prop and min-date prop together on calendar you periodically can't select new dates with button or by click(if you use auto-apply prop). So v-model isn't updating and event update:model-value can't be triggered until you choose dates again.

To Reproduce Steps to reproduce the behaviour:

  1. Add plain VueDatePicker component.
  2. Add range and min-date props to it.
  3. (Optional) Add update:model-value event to calendar to see when it's properly triggered
  4. Try to choose dates several times.

Expected behaviour v-model is updating every time you change dates and min-date prop doesn't break it. update:model-value event is working properly too.

Sandbox https://stackblitz.com/edit/vitejs-vite-r8wj37?file=src%2FApp.vue

Screenshots If applicable, add screenshots to help explain your problem.

Desktop & mobile (please complete the following information):

Jasenkoo commented 3 days ago

Expected behavior, as the time is also validated, in your case, the time after selection is bigger than the initially provided new Date() value, and there is no way a picker can know if time has passed or not. Reopening the menu will fix the issue, or simply set the time to 00:00