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

  

原文地址:https://www.cnblogs.com/wtfu/p/7798954.html