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

Commit 8769749

Browse files
Foxandxsswesleycho
authored andcommitted
fix(datepicker): assign initDate correctly to the controller
Closes #5541
1 parent 97244c7 commit 8769749

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/datepicker/datepicker.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,15 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
130130
break;
131131
case 'initDate':
132132
if ($scope.datepickerOptions.initDate) {
133-
this.activeDate = dateParser.fromTimezone($scope.datepickerOptions.initDate, ngModelOptions.timezone) || new Date();
133+
self.activeDate = dateParser.fromTimezone($scope.datepickerOptions.initDate, ngModelOptions.timezone) || new Date();
134134
$scope.$watch(function() { return $scope.datepickerOptions.initDate; }, function(initDate) {
135135
if (initDate && (ngModelCtrl.$isEmpty(ngModelCtrl.$modelValue) || ngModelCtrl.$invalid)) {
136136
self.activeDate = dateParser.fromTimezone(initDate, ngModelOptions.timezone);
137137
self.refreshView();
138138
}
139139
});
140140
} else {
141-
this.activeDate = new Date();
141+
self.activeDate = new Date();
142142
}
143143
}
144144
});

0 commit comments

Comments
 (0)