在datepicker-popup中禁用过去的日期 [英] Disable past dates in datepicker-popup

查看:251
本文介绍了在datepicker-popup中禁用过去的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码片段,其中datepicker控件在那里。

 < input type =textname =startDateclass =form-control input-smdatepicker-popup =dd-MMMM-yyyyng-model =startDate必需/> 

这里,我必须禁用datepicker控件中的过去日期,下面是我配置的它不工作。我在这里缺少某些东西?

  App.config(['datepickerConfig','datepickerPopupConfig',function(datepickerConfig,datepickerPopupConfig 
datepickerConfig.startingDay = 1;
datepickerConfig.showWeeks = true;

datepickerPopupConfig.datepickerPopup =dd-MMMM-yyyy;
datepickerPopupConfig.currentText =Now ;
datepickerPopupConfig.clearText =擦除;
datepickerPopupConfig.closeText =关闭;
}]);


解决方案

如果要缩小可能的日期范围, min-date max-date 正如示例



这里是相关的部分文档



  • max-date(默认值:null) - 定义最大可用日期。

  • min-date(默认值:null) - 定义最小可用日期。 b $ b


I have below code snippet in which datepicker control is there.

<input type="text" name="startDate" class="form-control  input-sm" datepicker-popup="dd-MMMM-yyyy" ng-model="startDate" required />

Here, i have to disable the past dates in the datepicker control and below is what i have configured but its not working. Am I missing something here?

App.config(['datepickerConfig', 'datepickerPopupConfig', function (datepickerConfig, datepickerPopupConfig) {
    datepickerConfig.startingDay = 1;
    datepickerConfig.showWeeks = true;

    datepickerPopupConfig.datepickerPopup = "dd-MMMM-yyyy";
    datepickerPopupConfig.currentText = "Now";
    datepickerPopupConfig.clearText = "Erase";
    datepickerPopupConfig.closeText = "Close";
}]);

解决方案

If you want to narrow the range of possible dates add min-date or max-date just as in the example.

Here's the relevant part of documentation:

  • max-date (Default: null) - Defines the maximum available date.
  • min-date (Default: null) - Defines the minimum available date.

这篇关于在datepicker-popup中禁用过去的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆