MagicMirror: Calendar: end date missing for multi day events (like holidays) (followup to #2529)

Platform: Raspberry Pi 3, current OS uname -r: 5.10.52-v7+

Node Version: what is this? how do I get this info?

MagicMirror Version: 2.16.0 (problem occured after upgrading from 2.13.0, problem still existed in 2.15.0).

Description: I show holidays with start and end dates. The shown config worked well with 2.13.0, after upgrading to 2.15.0/2.16.0 the end date disappeared. Now, only the current day of the current holiday is shown.

Steps to Reproduce: With my config in MM 2.16.0

Expected Results: start (or current) date AND end date “Sa 10. Apr. - Fr. 16. Apr.”

Actual Results: only start (or current) date “Sa 10. Apr.”

Configuration:

{
	module: "calendar",
	header: "Ferien Hessen",
	position: "top_bar",
	config: {
		tableClass: "medium",
		colored: true,
		fetchInterval: 900000,
		fullDayEventDateFormat: "dd DD. MMM",
		timeFormat: "absolute",
		urgency: 0,
		getRelative: 0,
		maximumEntries: 1,
		maxTitleLength: 50,
		showEnd: true,
		dateEndFormat: "dd DD. MMM",
		calendars: [
			{
				// Ferien Hessen 2021
				symbol: "democrat",
				color: "#ffbbbb",
				url: "https://www.ferienwiki.de/exports/ferien/2021/de/hessen"
			},
		]
	}
},

Additional Notes: The option “showEnd” is shown two times in the Calenders doku with similiar descritions!

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 27 (4 by maintainers)

Commits related to this issue

Most upvoted comments

No, i think you are right. You should address it in a new issue (feature request).

the code actually uses

					// Use dateFormat
					timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").format(this.config.dateFormat));
// then above code 
                                        if (this.config.showEnd) {     //  if end requested, format it 
						timeWrapper.innerHTML += "-";
						timeWrapper.innerHTML += this.capFirst(moment(event.endDate, "x").format(this.config.dateEndFormat));
					}  /* FIX else */   // uncomment this 
				// For full day events we use the fullDayEventDateFormat
				if (event.fullDayEvent) { // if this is a full day event, replace content above with this -----regardless of other settings ---- bug.. 
						//subtract one second so that fullDayEvents end at 23:59:59, and not at 0:00:00 one the next day
						event.endDate -= oneSecond;
						timeWrapper.innerHTML = this.capFirst(moment(event.startDate, 
"x").format(this.config.fullDayEventDateFormat));
					}

dateFormat for the startDate

@jupadin: You can find my configures symbol and color in the first post, it is

symbol: "democrat",
color: "#ffbbbb",

There you also see the set configured formats @sdetweil mentioned too.

fullDayEventDateFormat: "dd DD. MMM",
dateEndFormat: "dd DD. MMM",

But I think it should be dateEndFormat according to https://docs.magicmirror.builders/modules/calendar.html

@jupadin the cal entry shown does not show THE event start date, but TODAY thru the end. we don’t know WHEN it started in the past… could be yesterday, or in this case last month. you could change the fulldateFormat (check the spelling) to include the day I suppose…

thanks… very helpful… I created a matching one with an RRULE… i see they flipped ongoing to now hideOngoing vs showOngoing…

but the net is, I think there is a bug , the code (in calendar.js)

				if (this.config.showEnd) {     //  if end requested, format it 
						timeWrapper.innerHTML += "-";
						timeWrapper.innerHTML += this.capFirst(moment(event.endDate, "x").format(this.config.dateEndFormat));
					}  /* FIX else */   // uncomment this 
				// For full day events we use the fullDayEventDateFormat
				if (event.fullDayEvent) { // if this is a full day event, replace content above with this -----regardless of other settings ---- bug.. 
						//subtract one second so that fullDayEvents end at 23:59:59, and not at 0:00:00 one the next day
						event.endDate -= oneSecond;
						timeWrapper.innerHTML = this.capFirst(moment(event.startDate, 
"x").format(this.config.fullDayEventDateFormat));
					}

if u add an ‘else’ in between and set the settings like this

		{
			module: "calendar",
			header: "US Holidays",
			position: "top_left",
			config: {
						timeFormat:'absolute',
						showEnd: true,
						dateEndFormat:"MMM Do",
						getRelative:0,
						urgency:0,
				calendars: [
					{
						symbol: "calendar-check",
						//url: "webcal://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics"
						url: "http://localhost:8090/modules/default/calendar/sams-test.ics",

					}
				]
			}
		},

then u get the start/end as u expect