Vuepic / vue-datepicker

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

Month picker input - dialog model binding doesn't work properly #950

Closed nagymarci9411 closed 1 month ago

nagymarci9411 commented 1 month ago

Describe the bug I'm using the month-picker prop on a datepicker component and binding it with v-model to a previously saved date. This works perfectly for other modes like date-picker and year-picker, where the dialog displays the saved date correctly when opened. However, with month-picker, the dialog initially shows the current month and year instead. Once I make changes in the dialog, it functions correctly, but the issue persists on initialization.

To Reproduce Steps to reproduce the behavior: Open provided link to see the error: https://stackblitz.com/edit/vuepic-vue-datepicker-rmbqah?file=src%2Fcomponents%2FPlayground.vue

Expected behavior The model binding should work on initialization too, so the dialog displays the correct date on the first load.

Desktop & mobile (please complete the following information):

timmeijers commented 1 month ago

I am also experiencing the same thing, datepicker works fine indeed, only monthpicker does show the value of the current month instead of the one in the value, then it also emits this wrong value that changes my form value.

Only difference with @nagymarci9411 is that i am using version 8.8.0

Jasenkoo commented 1 month ago

@nagymarci9411 @timmeijers This is expected behavior as the default v-model binding for the month picker differs from the date picker, therefore by not providing an object, it is treaded as empty. You might want to take a look at model-type or provide an object value