我使用Bootstrap DateTimePicker来显示日历,我想从日历中删除一些天(禁用它们)
$(function () {
$('#datetimepicker1').datetimepicker({
inline: true,
format: "dd MM yyyy",
defaultDate: null,
disabledDates: function (date) {
var day = date.getDay();
return [(day != 1 && day != 2)];
}
})
}).on('dp.change', function (e, selectedDate, $td) {
//var time = e.date.format("HH:mm:ss");
//alert(e.date + ' - ' + time);
$('.input-field1').val(e.date.format("DD/MM/YYYY"));
if (check) {
$('.FormDownDateSelect').slideToggle("fast", function () { });
}
});
我尝试了上面的代码特殊部分与DisabledDates,但它不起作用。 有人可以告诉我如何禁用一周的某些日子。周日到周三。
答案 0 :(得分:3)
您可以使用here所述的daysOfWeekDisabled
设置。
您的代码看起来会像这样:
$(function () {
$('#datetimepicker1').datetimepicker({
inline: true,
format: "dd MM yyyy",
defaultDate: null,
daysOfWeekDisabled: [0, 6]
})
}).on('dp.change', function (e, selectedDate, $td) {
//var time = e.date.format("HH:mm:ss");
//alert(e.date + ' - ' + time);
$('.input-field1').val(e.date.format("DD/MM/YYYY"));
if (check) {
$('.FormDownDateSelect').slideToggle("fast", function () { });
}
});
答案 1 :(得分:0)
我相信使用=IF(MASTER!N2="Failed Check 1","Failed Check 1",IF(META!N2="Failed Check 2","Failed Check 2"), IF(OR(AND(Transformers!T2>=110, Transformers!T2<=75000),IFERROR(MATCH(Transformers!T2,kVolts,0)>0,FALSE)) ,"Failed Check 3","Passed Check 3")))
代替beforeShowDay
功能会更容易:
disabledDates