4
votes

I have 2 dates : StartDate and EndDate using angular-ui-bootstrap datepicker

When I choose a startDate (greater than today date) I set the min-date of EndDate datepicker at the startDate. So all dates <= startDate are disabled.

But the Today button in popup of EnDate can set today date which is not conform business rule.

Is there a way to disable the the Today button without disabling all the button-bar?

2
You can create your own popup.html template, and add an ngDisabled for the today button. You can add the logic for the ngDisabled by extending the datepicker directive - JoseM

2 Answers

1
votes

Sample HTMl for that:

ng-model , ng-change and min-date

<input type="text" uib-datepicker-popup="dd/MM/yyyy" ng-model="personForm.StartDate" name="startDate" ng-change="myStartDateChange()" />

<input type="text" uib-datepicker-popup="dd/MM/yyyy" min-date="endmindate" ng-model="personForm.EndDate" name="endDate" />

add function in your controller:

 $scope.myStartDateChange = function () {            
        $scope.endmindate= $scope.personForm.StartDate;
    }
0
votes

you should update ui-bootstrap version to 0.14.0 or laster. it could be fix this bug. https://github.com/angular-ui/bootstrap/pull/4199