[英]date-max-limit="" is not working in 720kb/angular-datepicker?
我正在使用 720kb/angular-datepicker。 日期最大限制不起作用。
我的 controller
$scope.currentDate = new Date().toString();
我的 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 圖書館鏈接在這里
您傳遞了錯誤的日期格式。無需轉換為日期格式。只需像下面這樣定義 & 在 date-max-limit 中以這種方式傳遞日期“{{maxDate | 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" />
您的日期不尊重您的輸入日期格式,因此請嘗試替換:
$scope.currentDate = new Date().toString();
有了這個:
$scope.currentDate = new Date().toISOString().split('T')[0];
你的 html 結構是錯誤的。 將date-max-limit="{{currentDate}}"
移至<datepicker>
元素。 見下文。
<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>
當您將 date-min-limit 或 date-max-limit 添加到 datepicker 元素時,它肯定會起作用。 下面為我工作
$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.