mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
added support for showing end of events through config parameters showEnd and dateEndFormat
This commit is contained in:
@@ -25,7 +25,9 @@ Module.register("calendar", {
|
|||||||
urgency: 7,
|
urgency: 7,
|
||||||
timeFormat: "relative",
|
timeFormat: "relative",
|
||||||
dateFormat: "MMM Do",
|
dateFormat: "MMM Do",
|
||||||
|
dateEndFormat: "HH:mm",
|
||||||
fullDayEventDateFormat: "MMM Do",
|
fullDayEventDateFormat: "MMM Do",
|
||||||
|
showEnd: true,
|
||||||
getRelative: 6,
|
getRelative: 6,
|
||||||
fadePoint: 0.25, // Start on 1/4th of the list.
|
fadePoint: 0.25, // Start on 1/4th of the list.
|
||||||
hidePrivate: false,
|
hidePrivate: false,
|
||||||
@@ -287,6 +289,10 @@ Module.register("calendar", {
|
|||||||
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow());
|
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(this.config.showEnd){
|
||||||
|
timeWrapper.innerHTML += "-" ;
|
||||||
|
timeWrapper.innerHTML += this.capFirst(moment(event.endDate , "x").format(this.config.fullDayEventDateFormat));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (event.startDate >= new Date()) {
|
if (event.startDate >= new Date()) {
|
||||||
if (event.startDate - now < 2 * oneDay) {
|
if (event.startDate - now < 2 * oneDay) {
|
||||||
@@ -325,6 +331,11 @@ Module.register("calendar", {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (this.config.showEnd) {
|
||||||
|
timeWrapper.innerHTML += "-";
|
||||||
|
timeWrapper.innerHTML += this.capFirst(moment(event.endDate, "x").format(this.config.dateEndFormat));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//timeWrapper.innerHTML += ' - '+ moment(event.startDate,'x').format('lll');
|
//timeWrapper.innerHTML += ' - '+ moment(event.startDate,'x').format('lll');
|
||||||
//console.log(event);
|
//console.log(event);
|
||||||
|
Reference in New Issue
Block a user