calendar-strip - fix days number by month
This commit is contained in:
parent
02554fa718
commit
bedbf7712a
2 changed files with 4 additions and 3 deletions
|
|
@ -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"))] = [];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
this.dates[day].push(mapadoDate.name)
|
||||
})
|
||||
|
||||
console.log(this.dates)
|
||||
console.log('dates', this.dates)
|
||||
}
|
||||
}"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue