IOS5版本里面的Safari解释new Date('2013-10-21') 就不正确,在IOS5的Safari中返回的永远是"Invalid Date"
解决办法:把2013-10-21这种格式的,通过正则(data.replace(/-/g, '/'))转换成2013/10/21
例子;
1 dateFormat (data) {2 let date1 = new Date(data.replace(/-/g, '/'))3 let date2 = date1.getFullYear() + '-' + date1.getMonth() + '-' + date1.getDate()4 return date25 }