时间数组排序
时间数组:
var timeArr = ["2015-07-02","2016-01-01","2015-07-03","2015-12-02"]
时间数组从小到大排序:
timeArr.sort((a,b)=>{ return parseInt(a.replace(/\D/g,''),10) - parseInt(b.replace(/\D/g,''),10) }) conosle.log(timeArr); //["2015-07-02","2015-07-03","2015-12-02","2016-01-01"]