nathanreyes / v-calendar

An elegant calendar and datepicker plugin for Vue.
https://vcalendar.io
MIT License
4.41k stars 863 forks source link

Disable date selection toggle? #553

Open arctic-ice-cool opened 4 years ago

arctic-ice-cool commented 4 years ago

Is it possible to disable the date selection toggle?

At the moment users can select a date using the picker, but if they reselect the same date it actually deselects it and nullifies / invalidates the date.

Is it possible to disable this behaviour?

Thanks!

IcyFoxe commented 3 years ago

Hello, I've been looking for the same answer. Here it is for anyone looking: https://vcalendar.io/datepicker.html#require-selected-date

CapitaineToinon commented 2 years ago

That doesn't solve the problem. I current have a date input that is optional but that default behavior of de-selecting the date when clicked a second time is simply not the expected behavior by the user, which is why this has been reported as a bug by our testing staff.

I would like the input to stay optional but that if the user selects the same date that is already selected, then nothing happens. I current have no work around.

CapitaineToinon commented 2 years ago

Okay the problem seems to be here, DatePicker.vue#L603 where the code clears the value if the new value is the same as the previous value. It seem that there is an internal value named clearIfEqual that already exists but current is only set as !isRequired. That would perfect if we could just have a clearIfEqual prop directly on the component!

SimmeNilsson commented 6 months ago

Also interested in this. Default behavior when it is not required feels weird to us, so would like to be able to change that.