const temp = [];
for (let i = 0; i < 15; i++) {
const time = new Date(new Date().setDate((new Date().getDate() + i) - 7));
const year = time.getFullYear();
const month = `0${time.getMonth() + 1}`.slice(-2);
const strDate = `0${time.getDate()}`.slice(-2);
temp.push(`${year}-${month}-${strDate}`)
}
console.log(temp);
网友评论