function zeroPrefix(val) {
return (val + '').padStart(2, '0');
}
function getTimeInterval() {
const [startYear, startMonth] = startTime.split('-');
const [endYear, endMonth] = endTime.split('-');
const startTimestamp = new Date(startYear, startMonth - 1).getTime();
const endTimestamp = new Date(endYear, endMonth - 1).getTime();
const intervals = [];
let timestamp = startTimestamp;
while (timestamp <= endTimestamp) {
const now = new Date(timestamp);
const year = now.getFullYear();
const month = now.getMonth() + 1;
intervals.push(`${year}-${zeroPrefix(month)}`);
timestamp = new Date(year, month).getTime();
}
return intervals;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…