Sort calendar entries by holiday then name

This commit is contained in:
2024-12-19 18:46:28 +00:00
parent 8f8f4179f9
commit 327bb6f7b9

View File

@@ -58,7 +58,8 @@
const day = new Date(currentDay);
day.setDate(day.getDate() + i);
const entries = upcoming.filter((entry) => {
const entries = upcoming
.filter((entry) => {
const entryStart = startOfDay(entry.start);
const entryEnd = endOfDay(entry.end);
@@ -67,6 +68,13 @@
}
return day >= entryStart && day <= entryEnd;
})
.sort((a, b) => {
if (a.isHoliday == b.isHoliday) {
return a.summary.localeCompare(b.summary);
}
return (b.isHoliday ? 1 : 0) - (a.isHoliday ? 1 : 0);
});
newCalendarDays.push(new CalendarDay(day, entries));