Support for hiding on-going events

This commit is contained in:
Janne Kalliola
2018-04-08 14:57:28 +03:00
parent 20b018bcc7
commit 30c5d78647
2 changed files with 8 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ Module.register("calendar", {
getRelative: 6,
fadePoint: 0.25, // Start on 1/4th of the list.
hidePrivate: false,
hideOngoing: false,
colored: false,
calendars: [
{
@@ -336,6 +337,7 @@ Module.register("calendar", {
createEventList: function () {
var events = [];
var today = moment().startOf("day");
var now = new Date();
for (var c in this.calendarData) {
var calendar = this.calendarData[c];
for (var e in calendar) {
@@ -346,6 +348,11 @@ Module.register("calendar", {
continue;
}
}
if(this.config.hideOngoing) {
if(event.startDate < now) {
continue;
}
}
event.url = c;
event.today = event.startDate >= today && event.startDate < (today + 24 * 60 * 60 * 1000);
events.push(event);