如何禁用magento中日历的上个月和年份选择箭头

时间:2014-07-22 12:17:35

标签: php magento date calendar

在我的magento日历中,我根据当前日期禁用了所有以前的日期。但即使我需要禁用我上一年和月份的选择箭头。但我没有得到禁用它的逻辑。请帮我。提前谢谢。

1 个答案:

答案 0 :(得分:0)

“下方”功能用于禁用上一个月和日期,此代码工作正常,

Calendar.setup({

    inputField: "vacation_mode_to_date",

    ifFormat: "%m/%e/%Y",

    showsTime: false,

    button: "vacation_mode_to_date_trig",

    align: "Bl",

    singleClick: true,

    dateStatusFunc : disabledDate 
    });

//disable the previous month ,year and date
function disabledDate(date)
{
       //getting the current values such as month,year and date
       var today = new Date();
       var current_day = today.getDate();
       var current_year = today.getFullYear();
       var current_month = today.getMonth();
       //getting the other month,date and year
       var month = date.getMonth();
       var day = date.getDate(); 
       var year=date.getFullYear();
       //only current and future values alone be enabled and others are disabled.
       return ((current_year==year)&&(current_month>month) ||current_year>year || (current_month==month)&&(current_year==year)&&(current_day>day));
}