MikaelEdebro / vue-airbnb-style-datepicker

A VueJs datepicker with a similar look and functionality as the popular AirBnb datepicker.
https://mikaeledebro.gitbooks.io/vue-airbnb-style-datepicker/
MIT License
505 stars 105 forks source link

Disable weekends #133

Open aleksisg opened 4 years ago

aleksisg commented 4 years ago

Is there a way of disabling the selecting of weekends without having to create a massive array of disabled dates?

aleksisg commented 4 years ago

If anyone else needs weekends to be disabled, this is the way I did it.

It doesn't actually disable them, but selects the next day if a Sunday is selected or two days time if a Saturday is selected. It isn't the slickest, but works...

v-on:date-one-selected="function(val) { if (new Date(val).getDay() == 6) {val = new Date(new Date(val).getTime()+(2*86400000))}; if (new Date(val).getDay() == 0) {val = new Date(new Date(val).getTime()+(1*86400000))}; }"