mirror of
https://github.com/ckaczor/HomeMonitor.git
synced 2026-01-13 17:22:54 -05:00
Sort calendar entries by holiday then name
This commit is contained in:
@@ -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));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user