示例
export const getMonthDate = (date = '2023-05-21') => {
let nowdays = date ? new Date(date) : new Date();
let year = nowdays.getFullYear();
let month = nowdays.getMonth() + 1;
if (month < 10) {
month = "0" + month;
}
let myDate = new Date(year, month, 0);
console.log(myDate.getDate());
let tempList = [];
for (let i = 1; i <= myDate.getDate(); i++) {
if (i < 10) {
tempList.push(year + "-" + month + "-" + "0" + i);
} else {
tempList.push(year + "-" + month + "-" + i);
}
}
return tempList;
};