From 5188463f69caef94a4b7c4196b7702c3f27fcd6f Mon Sep 17 00:00:00 2001 From: Guillaume Royer Date: Wed, 4 May 2016 09:37:44 +0800 Subject: [PATCH] fix(datepickerPopup): convert numbers to date before parsing Closes #5873 Fixes #5871 --- src/datepickerPopup/popup.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/datepickerPopup/popup.js b/src/datepickerPopup/popup.js index aac83d7d0a..071367e34a 100644 --- a/src/datepickerPopup/popup.js +++ b/src/datepickerPopup/popup.js @@ -133,12 +133,12 @@ function($scope, $element, $attrs, $compile, $log, $parse, $window, $document, $ return value; } - $scope.date = dateParser.fromTimezone(value, timezone); - - if (angular.isNumber($scope.date)) { - $scope.date = new Date($scope.date); + if (angular.isNumber(value)) { + value = new Date(value); } + $scope.date = dateParser.fromTimezone(value, timezone); + return dateParser.filter($scope.date, dateFormat); }); } else {