From b2627f74327e10c958d1c6ad2446cbfd6eff1703 Mon Sep 17 00:00:00 2001 From: byronigoe Date: Sun, 29 Jan 2017 17:03:08 -0500 Subject: [PATCH 1/2] Support JSON dates, which are really strings The formatter for non-HTML5 inputs had logic to convert a Number into a Date (Object), but nothing for Strings (like JSON dates). --- src/datepickerPopup/popup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/datepickerPopup/popup.js b/src/datepickerPopup/popup.js index 02c0e88a1c..35b8c86ab5 100644 --- a/src/datepickerPopup/popup.js +++ b/src/datepickerPopup/popup.js @@ -119,7 +119,7 @@ function($scope, $element, $attrs, $compile, $log, $parse, $window, $document, $ return value; } - if (angular.isNumber(value)) { + if (!angular.isObject(value)) { value = new Date(value); } From d840a95d5f3e73b4e078182b4c87a53b731ebeeb Mon Sep 17 00:00:00 2001 From: byronigoe Date: Sat, 11 Feb 2017 10:31:47 -0500 Subject: [PATCH 2/2] Better handling of JSON dates --- src/datepickerPopup/popup.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/datepickerPopup/popup.js b/src/datepickerPopup/popup.js index 35b8c86ab5..c47bbbae04 100644 --- a/src/datepickerPopup/popup.js +++ b/src/datepickerPopup/popup.js @@ -119,7 +119,7 @@ function($scope, $element, $attrs, $compile, $log, $parse, $window, $document, $ return value; } - if (!angular.isObject(value)) { + if (!angular.isDate(value)) { value = new Date(value); } @@ -356,7 +356,7 @@ function($scope, $element, $attrs, $compile, $log, $parse, $window, $document, $ } if (angular.isString(value)) { - return !isNaN(parseDateString(value)); + return !isNaN(parseDateString(value)) || value.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.000Z$/); } return false;