Reputation: 213
I am using two date picker:
I need to set max date in start date based in end-date value and min date in end-date based in start-date value
How to dynamically change the min and max value based on the date change in the date picker
I am using angular date picker with bootstrap 3
Upvotes: 2
Views: 7929
Reputation: 431
The following code is for singleDatePicker:
{
singleDatePicker: true,
maxDate: moment(), //this for current date
minDate : moment().subtract(1, 'days'), // this is for previous date
locale: {
format: 'YYYY-MM-DD'
}
}
Upvotes: 0
Reputation: 59
You can set the the min and max
attributes for the two date pickers in the following way.
<input type="date" ng-model="date1" max="{{date2 | date:'yyyy-MM-dd'}}">
<input type="date" ng-model="date2" min="{{date1 | date:'yyyy-MM-dd'}}">
Upvotes: 2