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

Commit

Permalink
fix(datepicker): assign initDate correctly to the controller
Browse files Browse the repository at this point in the history
Closes #5541
  • Loading branch information
Foxandxss authored and wesleycho committed Feb 25, 2016
1 parent 97244c7 commit 8769749
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/datepicker/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
break;
case 'initDate':
if ($scope.datepickerOptions.initDate) {
this.activeDate = dateParser.fromTimezone($scope.datepickerOptions.initDate, ngModelOptions.timezone) || new Date();
self.activeDate = dateParser.fromTimezone($scope.datepickerOptions.initDate, ngModelOptions.timezone) || new Date();
$scope.$watch(function() { return $scope.datepickerOptions.initDate; }, function(initDate) {
if (initDate && (ngModelCtrl.$isEmpty(ngModelCtrl.$modelValue) || ngModelCtrl.$invalid)) {
self.activeDate = dateParser.fromTimezone(initDate, ngModelOptions.timezone);
self.refreshView();
}
});
} else {
this.activeDate = new Date();
self.activeDate = new Date();
}
}
});
Expand Down

0 comments on commit 8769749

Please sign in to comment.