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

Commit

Permalink
fix(datepicker): min-date: timezone fix for literals v2
Browse files Browse the repository at this point in the history
  • Loading branch information
davious committed Nov 17, 2015
1 parent 70c469c commit 9fb5910
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/datepicker/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -629,16 +629,13 @@ function(scope, element, attrs, $compile, $parse, $document, $rootScope, $positi
scope.$parent.$watch(getAttribute, function(value) {
scope.watchData[key] = value;
if (key === 'minDate' || key === 'maxDate') {
var date = parseDate(value);
if (!date) {
date = new Date(value);
if (angular.isDate(date) && !isNaN(date)) {
var dateArray = date.toJSON().split('T')[0].split('-');
date = new Date(+dateArray[0], +dateArray[1] - 1, +dateArray[2]);
date.setFullYear(+dateArray[0]);
}
date = new Date(value);
if (angular.isString(value) && angular.isDate(date) && !isNaN(date)) {
var dateArray = date.toJSON().split('T')[0].split('-');
date = new Date(+dateArray[0], +dateArray[1] - 1, +dateArray[2]);
date.setFullYear(+dateArray[0]);
scope.watchData[key] = date;
}
scope.watchData[key] = date;
cache[key] = date;
}
});
Expand Down

0 comments on commit 9fb5910

Please sign in to comment.