4

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?

amgohan
  • 1,278
  • 2
  • 13
  • 23
  • You can create your own [popup.html template](https://github.com/angular-ui/bootstrap/blob/master/template/datepicker/popup.html), and add an `ngDisabled` for the today button. You can add the logic for the `ngDisabled` by [extending the datepicker directive](http://stackoverflow.com/a/17005383/238427) – JoseM Jun 03 '14 at 19:33

2 Answers2

1

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;
    }
Tarang
  • 36
  • 2
  • 9
0

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

sumail
  • 1