From 4b2ee0fa85e309437a137d7f9e2ab90fbd186ecf Mon Sep 17 00:00:00 2001 From: Wesley Cho Date: Tue, 2 Feb 2016 13:42:09 -0800 Subject: [PATCH] fix(datepicker): default to current date - When model is empty, default to current date Closes #5395 Fixes #5190 --- src/datepicker/datepicker.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/datepicker/datepicker.js b/src/datepicker/datepicker.js index 79542565e9..49ad11d19c 100644 --- a/src/datepicker/datepicker.js +++ b/src/datepicker/datepicker.js @@ -813,7 +813,8 @@ function(scope, element, attrs, $compile, $parse, $document, $rootScope, $positi scope.watchData[key] = value === null ? null : cache[key]; } else { - scope.watchData[key] = dateParser.fromTimezone(new Date(value), ngModelOptions.timezone); + var date = value ? new Date(value) : new Date(); + scope.watchData[key] = dateParser.fromTimezone(date, ngModelOptions.timezone); } }));