标签:turn logs bsp null span 时间 获取 get mon
function getLatelyDate(arrDate) { var arrMs = arrDate.map(function(time) { return new Date(time.replace(/\-/g, "\/")).getTime(); }, this); var max = Math.max.apply(null, arrMs); var date = new Date(max); return `${date.getFullYear()}-${this.turn(date.getMonth()+1)}-${this.turn(date.getDate())}`; }; function turn(str) { str = String(str); return str.length === 1 ? ‘0‘+str : str; }; var time = getLatelyDate([‘2018-06-27‘, ‘2017-06-21‘, ‘2015-02-2‘, ‘2017-08-2‘, ‘2017-04-15‘]); console.log(time); // 2018-06-27
标签:turn logs bsp null span 时间 获取 get mon
原文地址:http://www.cnblogs.com/sorrowx/p/7098524.html