Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Commit

Permalink
fix(datepicker): fix today button disabled condition
Browse files Browse the repository at this point in the history
- Fix conditional for today button in popup

Closes #5637
Fixes #5622
  • Loading branch information
wesleycho committed Mar 16, 2016
1 parent 8747b58 commit 316e96c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/datepicker/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1013,11 +1013,17 @@ function($scope, $element, $attrs, $compile, $log, $parse, $window, $document, $

$scope.isDisabled = function(date) {
if (date === 'today') {
date = new Date();
date = dateParser.fromTimezone(new Date(), ngModelOptions.timezone);
}

if ($scope.datepickerOptions) {
return $scope.datepickerOptions &&
$scope.datepickerOptions.minDate && $scope.compare(date, $scope.datepickerOptions.minDate) < 0 ||
$scope.datepickerOptions.maxDate && $scope.compare(date, $scope.datepickerOptions.maxDate) > 0;
}

return $scope.watchData.minDate && $scope.compare(date, cache.minDate) < 0 ||
$scope.watchData.maxDate && $scope.compare(date, cache.maxDate) > 0;
$scope.watchData.maxDate && $scope.compare(date, cache.maxDate) > 0;
};

$scope.compare = function(date1, date2) {
Expand Down

0 comments on commit 316e96c

Please sign in to comment.