计算时间间隔,中间的每一天。
function getDaysBetween(dateString1, dateString2) { var startDate = Date.parse(dateString1); var endDate = Date.parse(dateString2); while (startDate < endDate) { startDate = startDate + 1 * 24 * 60 * 60 * 1000; console.log(new Date(startDate)); } } getDaysBetween("2021-02-20", "2021-03-02")