fix: update attendance month handling to use lastMonths and correct month indexing

This commit is contained in:
2026-01-06 20:58:14 +01:00
parent 870c36a15d
commit 356c1b3295
4 changed files with 28 additions and 11 deletions

View File

@@ -253,6 +253,23 @@ function calculateMonthFromDay(startDay, days) {
}
}
function getLastMonthsWithYear(count) {
const result = []
const today = new Date()
let year = today.getFullYear()
let month = today.getMonth() // 0-11
for (let i = 0; i < count; i++) {
result.push({ year: year, month: month + 1 })
month--
if (month < 0) {
month = 11
year--
}
}
return result
}
export default {
getDayOfWeek,
extractTimeFromDateString,
@@ -267,4 +284,5 @@ export default {
getMonthNumber,
getMonthName,
daysOfWeek,
getLastMonthsWithYear,
}