Read the statement by Michael Teeuw here.
How to correctly configure the calendar module
-
I am trying to cofigure the calendar module in the following way but cannot make it happen so maybe someone can help me out:
- For today’s all day events, display Today
- For today’s event with a certain time, display Today, 9:00
- For tomororw’s all day events, display Tomorrow
- For tomorrow’s event with a certain time, display Tomorrow, 9:00
- For all other later events, display the date respectively date and time if not all-day event.
This is what my current config looks like:
module: "calendar", header: "Termine & Feiertage", position: "top_left", config: { fetchInterval: 300000, //5 Minute displaySymbol: true, showLocation: false, fade: true, fadePoint: 0.4, dateFormat: "D. MMM HH:mm", fullDayEventDateFormat: "D. MMM", timeFormat: "absolute", getRelative: 12, urgency: 0, maximumEntries: 10, displayRepeatingCountTitle: true, hideOngoing: false, nextDaysRelative: true, calendars: ... ] }
I have added
nextDaysRelative: true
as a temp solution to get the next day relative and know this should probably be removed.Any help would be appreciated.
-
@Feedy88 the code only does today/tomorrow/… for full day events, not with time.
and nextDaysRelative: true is required for full day events to show
if (event.fullDayEvent && this.config.nextDaysRelative) { // Full days events within the next two days if (event.today) { timeWrapper.innerHTML = CalendarUtils.capFirst(this.translate("TODAY")); } else if (event.yesterday) { timeWrapper.innerHTML = CalendarUtils.capFirst(this.translate("YESTERDAY")); } else if (event.startDate - now < ONE_DAY && event.startDate - now > 0) { timeWrapper.innerHTML = CalendarUtils.capFirst(this.translate("TOMORROW")); } else if (event.startDate - now < 2 * ONE_DAY && event.startDate - now > 0) { if (this.translate("DAYAFTERTOMORROW") !== "DAYAFTERTOMORROW") { timeWrapper.innerHTML = CalendarUtils.capFirst(this.translate("DAYAFTERTOMORROW")); } } }
-
@Feedy88 please don’t post in discord and the forums… pick one
-
@Feedy88 the code only does today/tomorrow/… for full day events, not with time.
and nextDaysRelative: true is required for full day events to show
if (event.fullDayEvent && this.config.nextDaysRelative) { // Full days events within the next two days if (event.today) { timeWrapper.innerHTML = CalendarUtils.capFirst(this.translate("TODAY")); } else if (event.yesterday) { timeWrapper.innerHTML = CalendarUtils.capFirst(this.translate("YESTERDAY")); } else if (event.startDate - now < ONE_DAY && event.startDate - now > 0) { timeWrapper.innerHTML = CalendarUtils.capFirst(this.translate("TOMORROW")); } else if (event.startDate - now < 2 * ONE_DAY && event.startDate - now > 0) { if (this.translate("DAYAFTERTOMORROW") !== "DAYAFTERTOMORROW") { timeWrapper.innerHTML = CalendarUtils.capFirst(this.translate("DAYAFTERTOMORROW")); } } }
-
@sdetweil Acknowledged to only post in one medium, sorry for that.
Thanks a lot for the code. Can you tell me where this has to be added?
-
@Feedy88 that is the existing code. only for fullDayEvent.