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

Commit

Permalink
fix(datepicker): dereference date initialization
Browse files Browse the repository at this point in the history
- Dereference the date set to active date to prevent model automatically
  updating from equal reference
  • Loading branch information
wesleycho committed Mar 17, 2016
1 parent bc7c55a commit b696389
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/datepicker/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
ngModelCtrl = ngModelCtrl_;
ngModelOptions = ngModelCtrl_.$options || datepickerConfig.ngModelOptions;

this.activeDate = ngModelCtrl.$modelValue || new Date();
this.activeDate = ngModelCtrl.$modelValue ?
dateParser.fromTimezone(new Date(ngModelCtrl.$modelValue), ngModelOptions.timezone) :
dateParser.fromTimezone(new Date(), ngModelOptions.timezone);

ngModelCtrl.$render = function() {
self.render();
Expand Down

0 comments on commit b696389

Please sign in to comment.