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,16 +58,24 @@
const day = new Date(currentDay); const day = new Date(currentDay);
day.setDate(day.getDate() + i); day.setDate(day.getDate() + i);
const entries = upcoming.filter((entry) => { const entries = upcoming
const entryStart = startOfDay(entry.start); .filter((entry) => {
const entryEnd = endOfDay(entry.end); const entryStart = startOfDay(entry.start);
const entryEnd = endOfDay(entry.end);
if (entry.isAllDay) { if (entry.isAllDay) {
return day > entryStart && day < entryEnd; return day > entryStart && day < entryEnd;
} }
return day >= entryStart && day <= entryEnd; 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)); newCalendarDays.push(new CalendarDay(day, entries));
} }