Issues with Date() when using JSON.stringify() and JSON.parse()

后端 未结 2 835
攒了一身酷
攒了一身酷 2020-12-01 10:33

I am trying to calculate the difference between two times using JavaScript. It\'s just basic math but I seem to have some issues with that while using JSON.stringify()

2条回答
  •  鱼传尺愫
    2020-12-01 11:00

    JSON.stringify(new Date())
    

    returns

    "2013-10-06T15:32:18.605Z"

    Thank God is: Date.prototype.toISOString()

提交回复
热议问题