shubhadip / vuejs3-datepicker

vue 3 datepicker. supports disabling, highlighting of dates and programmatic access of date.
https://vuejs3-datepicker.netlify.app/
MIT License
69 stars 40 forks source link

clearDate looses model reactivity #52

Closed alesf closed 1 year ago

alesf commented 1 year ago

After I call clearDate() on an instance or set the v-model variable to null and then select a new date within a calendar, v-model variable is no longer updating. Only if I set the v-model variable back to a date object it starts updating again.

I tried to locate the issue, but I'm having trouble finding it. Could you look into it?

let testDate = ref(new Date());
let inputDate = ref(null); // ref to Datepicker component

inputDate.value.clearDate();
// or 
testDate.value = null;
<Datepicker ref="inputDate" v-model="testDate" />

Stops working.

Only after i set testDate.value = new Date(); it start updating the testDate again.

I solved it with capturing selectedDate event and setting the v-model variable with event payload, but it's a dirty hack.

shubhadip commented 1 year ago

@alesf issue addressed in https://github.com/shubhadip/vuejs3-datepicker/pull/57