JSFiddle - React, Tailwind, and code Playground

by Wentz Wu

JavaScript

function dateTimeReviver(value) {
    var a;
    if (typeof value === 'string') {
        a = /\/Date\((\d*)\)\//.exec(value);
        if (a) {
            return new Date(+a[1]);
        }
    }
    return value;
};

var x = +new Date();
console.log(x.toString());
var from = dateTimeReviver("/Date(1336611200000)/");
alert(from);