new Date() 在iOS 的兼容
Posted Nextfuture
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了new Date() 在iOS 的兼容相关的知识,希望对你有一定的参考价值。
在ios 中 如果时间是 new Date("2017-08-08") 这种样式时,会直接返回NaN ,如果想要得到正确的时间格式,需要将其转换为 new Date("2017/08/08") 这种格式的
var str = "2017-08-08"; str = str.replace(/-/g,"/"); new Date(str);
以上是关于new Date() 在iOS 的兼容的主要内容,如果未能解决你的问题,请参考以下文章
new Date(date).getTime()不兼容iphone