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

Commit a417ec2

Browse files
committed
fix(datepicker): add intermediary valid date check
- Add intermediary check for whether the date is valid due to an IE quirk of turning a valid date into an invalid date when using the date constructor Closes #5872 Fixes #5865
1 parent d923df9 commit a417ec2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/datepicker/datepicker.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,9 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
169169
self.activeDate = new Date();
170170
}
171171

172-
this.activeDate = ngModelCtrl.$modelValue ?
173-
dateParser.fromTimezone(new Date(ngModelCtrl.$modelValue), ngModelOptions.timezone) :
172+
var date = ngModelCtrl.$modelValue ? new Date(ngModelCtrl.$modelValue) : new Date();
173+
this.activeDate = !isNaN(date) ?
174+
dateParser.fromTimezone(date, ngModelOptions.timezone) :
174175
dateParser.fromTimezone(new Date(), ngModelOptions.timezone);
175176

176177
ngModelCtrl.$render = function() {

0 commit comments

Comments
 (0)