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

Commit b696389

Browse files
committed
fix(datepicker): dereference date initialization
- Dereference the date set to active date to prevent model automatically updating from equal reference
1 parent bc7c55a commit b696389

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: src/datepicker/datepicker.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,9 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
271271
ngModelCtrl = ngModelCtrl_;
272272
ngModelOptions = ngModelCtrl_.$options || datepickerConfig.ngModelOptions;
273273

274-
this.activeDate = ngModelCtrl.$modelValue || new Date();
274+
this.activeDate = ngModelCtrl.$modelValue ?
275+
dateParser.fromTimezone(new Date(ngModelCtrl.$modelValue), ngModelOptions.timezone) :
276+
dateParser.fromTimezone(new Date(), ngModelOptions.timezone);
275277

276278
ngModelCtrl.$render = function() {
277279
self.render();

0 commit comments

Comments
 (0)