mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-29 12:39:45 +00:00
All events from the beginning of today were fetched but we only want the ones that are ongoing or upcoming.
This commit is contained in:
parent
056f3a6ccb
commit
2779d19d5c
@ -376,7 +376,17 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
|
|||||||
return a.startDate - b.startDate;
|
return a.startDate - b.startDate;
|
||||||
});
|
});
|
||||||
|
|
||||||
events = newEvents.slice(0, maximumEntries);
|
if (includePastEvents) {
|
||||||
|
// Include all events
|
||||||
|
events = newEvents;
|
||||||
|
} else {
|
||||||
|
// All events from startOfToday are fetched but we only want the ones that haven't ended yet
|
||||||
|
const now = moment();
|
||||||
|
for (ne of newEvents) {
|
||||||
|
if (moment(ne.endDate, "x").isAfter(now)) events.push(ne);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
events = events.slice(0, maximumEntries);
|
||||||
|
|
||||||
self.broadcastEvents();
|
self.broadcastEvents();
|
||||||
scheduleTimer();
|
scheduleTimer();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user