calendar-strip - fix days number by month

This commit is contained in:
isUnknown 2024-07-24 18:09:19 +02:00
parent 02554fa718
commit bedbf7712a
2 changed files with 4 additions and 3 deletions

View file

@ -2,11 +2,12 @@ dayjs.locale("fr");
function getDatesInMonth(month) {
const year = dayjs().month(month).year();
const daysInMonth = dayjs(new Date(year, month, 0)).daysInMonth();
const daysInMonth = dayjs(new Date(year, month, 0)).daysInMonth() + 1;
const dates = {};
for (let day = 1; day <= daysInMonth; day++) {
const currentDay = dayjs(new Date(year, month - 1, day));
const currentDay = dayjs(new Date(year, month, day));
console.log(currentDay.format("DD-MM-YYYY"));
dates[parseInt(currentDay.format("DD"))] = [];
}

View file

@ -19,7 +19,7 @@
this.dates[day].push(mapadoDate.name)
})
console.log(this.dates)
console.log('dates', this.dates)
}
}"