Answer the question
In order to leave comments, you need to log in
How to disable all dates except a few in the datepicker?
I'm using this datepicker plugin but can't figure out how to disable all but a few dates?
<script>
import Datepicker from "vuejs-datepicker";
import { ru } from "vuejs-datepicker/dist/locale";
export default {
data() {
return {
ru: ru,
highlighted: {
// dates: [
// // Highlight an array of dates
// new Date(2021, 3, 16),
// new Date(2021, 4, 17),
// new Date(2021, 4, 18),
// ],
includeDisabled: false, // Highlight disabled dates
},
};
},
components: {
Datepicker,
},
};
</script>
Answer the question
In order to leave comments, you need to log in
data() {
return {
dates: [ массив допустимых дат, в числовом виде (количество миллисекунд) ],
disabledFn: {
customPredictor: date => !this.dates.includes(new Date(date).setHours(0, 0, 0, 0)),
},
};
},
<datepicker :disabledDates="disabledFn" />
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question