简体   繁体   English

date-max-limit="" 在 720kb/angular-datepicker 中不起作用?

[英]date-max-limit="" is not working in 720kb/angular-datepicker?

I'm using 720kb/angular-datepicker.我正在使用 720kb/angular-datepicker。 date-max-limit is not working.日期最大限制不起作用。

My controller我的 controller

$scope.currentDate = new Date().toString();

My HTML colde我的 HTML 冷

<datepicker date-format="yyyy-MM-dd">
<input type='text' class="titleInput date" id="lastmodifiedDate" name="lastmodifiedDate"
       date-max-limit="{{currentDate}}"
       ng-model="studyDetails.lastmodifiedDate" ng-blur="updateStudy('isForceSave')"/>

Github library link here Github 图书馆链接在这里

You passed wrong date format.No need to convert into date format.Simply define like below & in date-max-limit pass the date in this way "{{maxDate | date}}".you need to add date filter.It will work definitely.您传递了错误的日期格式。无需转换为日期格式。只需像下面这样定义 & 在 date-max-limit 中以这种方式传递日期“{{maxDate | date}}”。您需要添加日期过滤器。它会工作肯定。

$scope.maxDate = new Date(); $scope.maxDate = 新日期();

<div class="datepicker w-80 pull-right"
                    date-format="dd-MMMM-yyyy"               
                    date-max-limit="{{maxDate | date}}"
                    button-prev='<i class="fa fa-arrow-circle-left"></i>'
                    button-next='<i class="fa fa-arrow-circle-right"></i>'>                                                      
                   <input placeholder="Select DOB" readonly ng-model="users.dob" type="text"  class="searchbar3 w-100"  />

Your date doesn't respect your input date format, so try replace this :您的日期不尊重您的输入日期格式,因此请尝试替换:

$scope.currentDate = new Date().toString();

with this :有了这个:

$scope.currentDate = new Date().toISOString().split('T')[0];

Your html structure is wrong.你的 html 结构是错误的。 Move date-max-limit="{{currentDate}}" to the <datepicker> element.date-max-limit="{{currentDate}}"移至<datepicker>元素。 See below.见下文。

<datepicker date-format="yyyy-MM-dd" date-max-limit="{{currentDate}}" selector="form-control">
     <input ng-model="income.date" type="text" class="form-control"  required>
</datepicker>

When you add date-min-limit or date-max-limit to the datepicker element it works for sure.当您将 date-min-limit 或 date-max-limit 添加到 datepicker 元素时,它肯定会起作用。 Below worked for me下面为我工作

$scope.minDate = new Date();

<datepicker date-format="MM/dd/yyyy" date-min-limit="{{minDate | date}}" class="date-picker">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 带有动态创建按钮的720kb SocialShare共享 - 720kb SocialShare share with dinamic created button 如何减少 Angular JS 应用程序的大小,其中 vendor.js 为 2MB,app.js 为 720KB? - How to reduce size for Angular JS app where vendor.js is 2MB and app.js is 720KB? 更改角度日期选择器语言 - Change angular-datepicker language 在 Angular 8 中为应用程序全局设置打字稿中 DatePicker 的日期最小值和最大值限制 - Setting date min and max limit for DatePicker in Angular 8 in typescript globally for the application angular-datepicker在ngDialog中不起作用 - angular-datepicker doesn't work in ngDialog 当我使用angular-datepicker删除以前保存的日期时,该表单始终无效 - The form is always invalid when I erase previously saved date with angular-datepicker 在同一 Angular.js 应用程序中使用“ui.bootstrap”和“720kb.datepicker”模块时出错 - Getting error while using 'ui.bootstrap' and '720kb.datepicker' module in same Angular.js application angular-datepicker:将ng-model值纳入范围 - angular-datepicker: get ng-model value into scope 当日期选择器和相邻元素之间没有空格时,Angular-Datepicker不起作用? - Angular-Datepicker does not work when there is no space between datepicker and adjacent element? 在angular-datepicker(pickadate.js)中设置服务调用结果中的选项 - Set options from service call results in angular-datepicker (pickadate.js)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM