From b6434ba02b57f80a04ca9b8627180ea99404827e Mon Sep 17 00:00:00 2001 From: Wesley Cho Date: Tue, 15 Mar 2016 21:04:03 -0700 Subject: [PATCH] fix(datepicker): fix today button disabled condition - Fix conditional for today button in popup --- src/datepicker/datepicker.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/datepicker/datepicker.js b/src/datepicker/datepicker.js index f6df0f9536..e949ead335 100644 --- a/src/datepicker/datepicker.js +++ b/src/datepicker/datepicker.js @@ -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) {