JQuery日历(http://arshaw.com/fullcalendar/):禁用已过日期


JQuery Calendar(http://arshaw.com/fullcalendar/) :Disable the passed date

我正在使用jquery日历来显示我的日历,现在我正在尝试禁用已过日期的日历

不幸的是,我找不到任何东西来做这件事?

请帮我判断是否可能

设置minDate选项如下

minDate: new Date()

在日期选择器函数中调用

这应该有效!!

在fullcalendar.js 中搜索此行

cell.addClass('fc-other-month');

将其更改为

cell.addClass('fc-other-month');
if (date < new Date())
{
    $(cell).attr('disabled', 'disabled');
}

如果不使用Jquery,那么亲爱的,你可以使用这个函数(尽管我建议使用Jquery是一种更好的解决方案)

function checkdate(){
       var myDate = new Date(document.frm.date.value);
       var today = new Date();
       if (myDate<today){
         alert('You can not enter future date')
         return false;
       }
       return true;
    }

尝试

$(function(){
    $("#datepicker").datepicker({showOn: "both", minDate: 0});
});

使用此选项,您将不会在日期选择器中超过日期……:)