我正在使用以下代码来阻止我的jQuery UI日期选择器中的所有星期日。我今天也想阻止今天和今后3个工作日。有谁知道如何做到这一点?
$("#pick-delivery-date").datepicker({
dateFormat: 'yy-mm-dd',
altField: "#selected-delivery-date",
altFormat: "DD, d MM, yy",
beforeShowDay: function(date){
var day = date.getDay();
return [(day != 0), ''];
}
});
答案 0 :(得分:1)
如何使用minDate选项,比如......
{minDate:+3}
答案 1 :(得分:0)
var unavailableDates = ["9-5-2011","14-5-2011","15-5-2011"];
$("#pick-delivery-date").datepicker({
dateFormat: 'yy-mm-dd',
altField: "#selected-delivery-date",
altFormat: "DD, d MM, yy",
beforeShowDay: function(date){
dmy = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear();
if ($.inArray(dmy, unavailableDates) < 0) {
return [true,"","Book Now"];
} else {
return [false,"","Booked Out"];
}
}
});