redux-auto icon indicating copy to clipboard operation
redux-auto copied to clipboard

Add Date support smartActions

Open codemeasandwich opened this issue 4 years ago • 0 comments

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);

From: deserializing json strings as javascript date objects

codemeasandwich avatar Mar 16 '20 16:03 codemeasandwich