redux-auto
redux-auto copied to clipboard
Add Date support smartActions
const dateFormat = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/;
function reviver(key, value) { if (typeof value === "string" && dateFormat.test(value)) { return new Date(value); }
return value; }
const text = '{ "date": "2016-04-26T18:09:16Z" }'; const obj = JSON.parse(text, reviver);
console.log(typeof obj.date);