我有一个日历,我想设置几天停用。有人对此有经验吗?在 github 上它说:
disableDayFn: callback function that gets passed a Date object for each day in view. Should return true to disable selection of that day.
但是我该如何使用它呢?
var bookingPicker = new Pikaday(
{
field: $(self.options.calendarInput, container)[0],
container: $(self.options.calendarContainer, container)[0],
minDate: new Date(),
bound: false,
firstDay: 1,
onOpen: function () {
this.disableDayFn(23); //<--- ???
},
onSelect: function (date) {
},
onDraw: function (date) {
console.log("NEW MONTH")
}
}
);
最佳答案
var bookingPicker = new Pikaday(
{
field: $(self.options.calendarInput, container)[0],
container: $(self.options.calendarContainer, container)[0],
minDate: new Date(),
bound: false,
firstDay: 1,
onOpen: function () {
this.disableDayFn(23); //<--- ???
},
onSelect: function (date) {
},
onDraw: function (date) {
console.log("NEW MONTH")
},
disableDayFn: function(dateTime){
/* here you can access each day shown and disable those in your range. To disable just return true*/
}
}
);
关于javascript - 皮卡迪.js : How to disbale days in calendar?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29795491/