From c3b2aaec6935c2921b7ee8b1c8e51fccba1080b3 Mon Sep 17 00:00:00 2001 From: rejas Date: Tue, 10 May 2022 21:44:15 +0200 Subject: [PATCH] Show endDate for calendar events when dateHeader is enabled and showEnd is set to true --- modules/default/calendar/calendar.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 4a003daa..91e952d6 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -305,6 +305,12 @@ Module.register("calendar", { timeWrapper.className = "time light align-left " + this.timeClassForUrl(event.url); timeWrapper.style.paddingLeft = "2px"; timeWrapper.innerHTML = moment(event.startDate, "x").format("LT"); + + // Add endDate to dataheaders if showEnd is enabled + if (this.config.showEnd) { + timeWrapper.innerHTML += " - " + moment(event.endDate, "x").format("LT"); + } + eventWrapper.appendChild(timeWrapper); titleWrapper.classList.add("align-right"); } @@ -381,7 +387,7 @@ Module.register("calendar", { } } } else if (event.startDate - now < this.config.getRelative * oneHour) { - // If event is within getRelative hours, display 'in xxx' time format or moment.fromNow() + // If event is within getRelative hours, display 'in xxx' time format or moment.fromNow() timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow()); } } else {