Innologica / vue2-daterange-picker

Vue2 date range picker
https://innologica.github.io/vue2-daterange-picker/
MIT License
329 stars 209 forks source link

When opening the picker with togglePicker, start date is not selected #295

Open tkrevh opened 2 years ago

tkrevh commented 2 years ago

I have a case, where we need to open the picker programmatically using togglePicker when editing a scheduled post. The picker opens, but it doesn't select the initial date and time.

If the picker is opened via users input, the initial date and time and selected.

Any ideas?

tkrevh commented 2 years ago

I was able to work around it by calling dateClick with the initial value after the toggle.

tkrevh commented 2 years ago

Ok,

after some code review and testing, I think I've found the issue.

We're using singleDatePicker and the isClear computed property is checking if both startDate and endDate are set. Then the dateRange.startDate watcher does not set the this.start data property, because isClear is true.

For a fix, I suggest only checking in isClear computed property if endDate is set, if singleDatePicker=false

tkrevh commented 2 years ago

Submitted PR #296