2
我需要爲我的jQueryUI日期選擇器的maxDate根據當天動態更新。現在,正如您將在下面看到的,由於我們的團隊只能在星期五至星期日報告問題,因此有一項功能用於禁用星期一至星期四。所以我需要做的就是讓球隊能夠在週末繼續報道,但直到週四才能在下週末繼續報道。例如,今天是星期一,球隊仍然可以報告上週四至週日的問題,直到週四才能選擇下週末的一天。這可能嗎?jQuery UI datepicker maxdate
這裏是我的代碼至今:
var fullDate = new Date();
var twoDigitMonth = ((fullDate.getMonth().length+1) === 1)? (fullDate.getMonth()+1) : '0' + (fullDate.getMonth()+1);
$('#startdate').datepicker({
maxDate: twoDigitMonth + "/" + fullDate.getDate() + "/" + fullDate.getFullYear(),
beforeShowDay: disableSpecificWeekDays
});
function disableSpecificWeekDays(date) {
if((date.getDay()==0) || (date.getDay() == 5) || (date.getDay() == 6)){
return [true];
}else{
return [false];
}
}