From c6d2549a5255822290853aae8d922848b81bed62 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 3 Nov 2011 10:28:28 -0700 Subject: fix(JSON): json date parsing same native/ngular parser --- src/JSON.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/JSON.js') diff --git a/src/JSON.js b/src/JSON.js index 7fdbf1a1..d0ded009 100644 --- a/src/JSON.js +++ b/src/JSON.js @@ -40,15 +40,17 @@ function fromJson(json, useNative) { try { if (useNative && window.JSON && window.JSON.parse) { obj = JSON.parse(json); - return transformDates(obj); + } else { + obj = parser(json, true).primary()(); } - return parser(json, true).primary()(); + return transformDates(obj); } catch (e) { error("fromJson error: ", json, e); throw e; } // TODO make forEach optionally recursive and remove this function + // TODO(misko): remove this once the $http service is checked in. function transformDates(obj) { if (isString(obj) && obj.length === DATE_ISOSTRING_LN) { return angularString.toDate(obj); -- cgit v1.2.3