js 获取两日期之间的所有日期
const startDate = new Date('2022-05-01');
const endDate = new Date('2022-10-10');
// 使用一个循环,从起始日期开始逐一增加日期,直到到达结束日期为止,并将每个日期添加到一个数组dateArray中。
const dateArray = [];
let currentDate = startDate;
while (currentDate <= endDate) {
dateArray.push(new Date(currentDate));
currentDate.setDate(currentDate.getDate() + 1);
}