我有一个像这样的JavaScript数组。
我试着用datepicker beforeShowday这样的配置来禁用这些日期:
beforeShowDay: function(date) {
var string = jQuery.datepicker.formatDate('dd/mm/yy', calendar.holidays);
return [ array.indexOf(string) == -1 ]
}
但我想停用的日期却一直出现
文档:
该函数在datepicker中的每一天显示之前都会被调用。
所以我们的代码应该:对于 date
传入,这将是每个要显示的日期。jQuery.datepicker.formatDate
并检查所产生的字符串是否是其中之一。holidays
.
类似于:
beforeShowDay: function(date) {
var string = jQuery.datepicker.formatDate('mm/dd/yy', date);
return [ calendar.holidays.indexOf(string) == -1 ]
}