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

Commit

Permalink
fix(datepicker): pass through null
Browse files Browse the repository at this point in the history
- When `minDate` or `maxDate` is `null` in the popup, pass through value to inline datepicker
  • Loading branch information
wesleycho committed Jan 16, 2016
1 parent 2cb3bc2 commit df12b55
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/datepicker/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -685,10 +685,18 @@ function(scope, element, attrs, $compile, $parse, $document, $rootScope, $positi

scope.$parent.$watch(getAttribute, function(value) {
if (key === 'minDate' || key === 'maxDate') {
cache[key] = angular.isDate(value) ? dateParser.fromTimezone(new Date(value), ngModelOptions.timezone) : new Date(dateFilter(value, 'medium'));
if (value === null) {
cache[key] = null;
} else if (angular.isDate(value)) {
cache[key] = dateParser.fromTimezone(new Date(value), ngModelOptions.timezone);
} else {
cache[key] = new Date(dateFilter(value, 'medium'));
}

scope.watchData[key] = value === null ? null : cache[key];
} else {
scope.watchData[key] = dateParser.fromTimezone(new Date(value), ngModelOptions.timezone);
}

scope.watchData[key] = cache[key] || dateParser.fromTimezone(new Date(value), ngModelOptions.timezone);
});

datepickerEl.attr(cameltoDash(key), 'watchData.' + key);
Expand Down

0 comments on commit df12b55

Please sign in to comment.