Vuepic / vue-datepicker

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

Invalid time value when setting date programmatically #792

Closed tasiotas closed 6 months ago

tasiotas commented 6 months ago

Version: 8.3.1 Repro: https://stackblitz.com/edit/vuepic-vue-datepicker-njwx53?file=src%2Fcomponents%2FPlayground.vue Open console and press button Set Today

This used to work for me, but on the latest version it gives me error. I am not sure why or what am I missing in the config.

Setting date as a range [date, date] works fine, but when I want to set single date, I get this error

Uncaught RangeError: Invalid time value

this is how I set the date

function today() {
  console.log('setting today');
  var now = new Date();
  pickerRef.value.parseModel(now);
  pickerRef.value.selectDate();
}
tasiotas commented 6 months ago

I found the correct way to input single date pickerRef.value.parseModel([now, now])