【问题标题】:how to disable previous month and year selection arrows of calendar in magento如何在magento中禁用日历的上个月和年份选择箭头
【发布时间】:2014-09-13 06:19:24
【问题描述】:

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

【问题讨论】:

  • 你想在 Magento 的前端或管理面板中执行此操作吗?

标签: php magento date calendar


【解决方案1】:

Below 函数用于禁用上个月和日期此代码工作得很好,

日历.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));
}

【讨论】:

  • 这不会禁用其他月份/年份的循环,只是禁用选择特定日期的能力。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-10-29
  • 1970-01-01
相关资源
最近更新 更多