【发布时间】:2021-08-23 13:08:02
【问题描述】:
理想情况下,日期数组将检查我的谷歌日历中的日期,我想在我的日历中阻止这些日期
<script> $(document).ready(function(){
var dates = ["06-08-2021"];
function DisableDates(date) {
var string = jQuery.datepicker.formatDate('mm-dd-yy', date);
return [dates.indexOf(string) == -1];
}
$("#datepicker").datepicker({
dateFormat: 'mm-dd-yy',
beforeShowDay: $.datepicker.noWeekends,
beforeShowDay: DisableDates
});
})
</script>
【问题讨论】:
-
去掉
noWeekends并在DisableDates()函数中检查日期索引。对象不能有重复的键 -
那么我该如何添加这两个功能呢?
-
周日索引为零,周六为6