Date.parse() method not work in IOS

Maybe it's a big bug that I had experienced recently, when I use JavaScript method Date.parse('2016-10-24 18:36'), two different outputs in Android and IOS. In Android it output the right timestamp which i need, but in IOS, it can not get the timestamp.

How To Fixed it

Just use the ISO 8601 format, it works well, for example:

var a = Date.parse('2016-11-25T16:11:00Z');
console.log(a);

This code can run in both Android and IOS.

 标签: JavaScript, Date, 前端开发

作者  :  sailor

仅仅看明白了还不够,能把别人给讲明白了才算及格。


  1. 进来看看

    December 17th, 2016 at 07:10 pm 回复


最新文章