Jquery ui 在Jquery UI日历中禁用未来一周

Jquery ui 在Jquery UI日历中禁用未来一周,jquery-ui,calendar,week-number,jquery-week-calendar,Jquery Ui,Calendar,Week Number,Jquery Week Calendar,我需要禁用jqueryUI日历的未来几周,我尝试了禁用未来日期的东西。但我想禁用未来一周,第52周的其他日期也是禁用的。如果有人能在这方面帮助我,请告诉我。下面是我的工作链接。在这里,您可以看到第52周的禁用日期。我要整整一周 $(“.weekcal-x”).datepicker({ 《秀周刊》:没错, 第一天:1, maxDate:新日期, onSelect:函数(日期文本,inst){ $(this.val(“Week”+$.datepicker.iso8601Week(new Date

我需要禁用jqueryUI日历的未来几周,我尝试了禁用未来日期的东西。但我想禁用未来一周,第52周的其他日期也是禁用的。如果有人能在这方面帮助我,请告诉我。下面是我的工作链接。在这里,您可以看到第52周的禁用日期。我要整整一周


$(“.weekcal-x”).datepicker({
《秀周刊》:没错,
第一天:1,
maxDate:新日期,
onSelect:函数(日期文本,inst){
$(this.val(“Week”+$.datepicker.iso8601Week(new Date(dateText))+,“+$.datepicker.formatDate(“yy”,new Date(dateText)));
}
}).datepicker('widget').addClass('ui-weekpicker');
$('.ui weekpicker')。在('mousemove','tr',function()上{
$(this.find('td a').addClass('ui-state-hover');
});
$('.ui weekpicker')。在('mouseleave','tr',function()上{
$(this.find('td a').removeClass('ui-state-hover');
});
试试这个

maxDate:+7
而不是
maxDate:new Date

更新

获取当前周的第一天和最后一天:

var currentDate = new Date; // get current date
var first = currentDate.getDate() - currentDate.getDay() + 1; // First day is the day of the month - the day of the week
var last = first + 6; // last day is the first day + 6

var firstday = new Date(currentDate.setDate(first));
var lastday = new Date(currentDate.setDate(last));

现在您可以根据需要使用它们,如
maxDate:lastday,minDate:firstday

[link]显示结果不准确。它只允许启用7天而不是一周。我只想启用当前日期的星期。我已更新了答案。有关更多信息,请参阅此
var currentDate = new Date; // get current date
var first = currentDate.getDate() - currentDate.getDay() + 1; // First day is the day of the month - the day of the week
var last = first + 6; // last day is the first day + 6

var firstday = new Date(currentDate.setDate(first));
var lastday = new Date(currentDate.setDate(last));