简体   繁体   中英

angular-ui bootstrap datepicker (how to disable only today button on popup)

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?

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

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;
    }

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