function getDates() {
var new_Date = new Date()
var timesStamp = new_Date.getTime();
var currenDay = new_Date.getDay();
var dates = [];
for(var i = 0; i < 7; i++) {
dates.push(new Date(timesStamp + 24 * 60 * 60 * 1000 * (i - (currenDay + 6) % 7)).toLocaleDateString().replace(/[年月]/g, '-').replace(/[日上下午]/g, ''));
}
return dates
}
console.log(getDates())
网友评论