aboutsummaryrefslogtreecommitdiffstats
path: root/src/JSON.js
diff options
context:
space:
mode:
authorMisko Hevery2011-11-03 10:28:28 -0700
committerMisko Hevery2011-11-14 16:39:33 -0800
commitc6d2549a5255822290853aae8d922848b81bed62 (patch)
tree51183fb4dfba5dfd457b76b05f18f5a77f798798 /src/JSON.js
parentbee6060e4b2499b385465e20f7a0dc2d11f003c0 (diff)
downloadangular.js-c6d2549a5255822290853aae8d922848b81bed62.tar.bz2
fix(JSON): json date parsing same native/ngular parser
Diffstat (limited to 'src/JSON.js')
-rw-r--r--src/JSON.js6
1 files changed, 4 insertions, 2 deletions
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);