Vuepic / vue-datepicker

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

Updating week-picker and month-picker by external function(not clicking on the calendar properly) won't reflect in the picker #889

Closed IulianGT closed 1 month ago

IulianGT commented 1 month ago

Describe the bug When trying to update the week number or month number by changing the date with the v-modeled value, which works properly on singleSelectPicker the month and week pickers won't show the right month/week.

To Reproduce Use VueDatePicker with week-picker or month-picker mode, Create a button that will calculate the referenced value on the date-picker by it's current value + 7 days and set the ref to the correct 7 days after date.

something like: // calendarDate - v-model value that i used on the date picker. const calendarDate = ref(new Date(Date.now()));

function handlePrevMonth() { const prevDate: Date = new Date(calendarDate.value); prevDate.setMonth(calendarDate.value.getMonth() - 1); calendarDate.value = prevDate; }

Expected behavior Expect the date picker to reflect the next week. it won't happen

Screenshots image

Desktop & mobile (please complete the following information):

Jasenkoo commented 1 month ago

It works as expected, make sure that the values provided are in the correct format. Check this example using inline month-picker