简体   繁体   中英

Disabling future date in daterange picker using moment.js

I have a daterange picker in my HTML file

<input date-range-picker class="form-control date-picker" type="text" 
ng-model="datePicker.date" options="onApplyDateRange"/>

I want to know that is it possible to validate it using moment.js .I have been trying to validate it but I'm not able to get it working. Please help

I have used https://www.npmjs.com/package/angular-daterangepicker https://github.com/fragaria/angular-daterangepicker

you can try using max in the html and get the maxdate from controller

<input date-range-picker class="form-control date-picker" type="text" ng-model="datePicker.date" max="maxdate" options="onApplyDateRange"/>

Controller

$scope.maxdate = new Date();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM