Skip to content

fix(calendar): show end date for multi-day full-day events in all timeFormats#4059

Draft
KristjanESPERANTO wants to merge 4 commits intoMagicMirrorOrg:developfrom
KristjanESPERANTO:fix/calendar4053
Draft

fix(calendar): show end date for multi-day full-day events in all timeFormats#4059
KristjanESPERANTO wants to merge 4 commits intoMagicMirrorOrg:developfrom
KristjanESPERANTO:fix/calendar4053

Conversation

@KristjanESPERANTO
Copy link
Collaborator

Closes #4053

What was broken

showEnd: true had no effect for multi-day full-day events unless timeFormat was "absolute" (without nextDaysRelative). In "relative" and "dateheaders" mode the end date was simply never rendered.

What I changed

dateheaders: Full-day events always got colSpan="2" on the title cell. Now, when the event spans multiple days and showEnd is set, a separate time cell with startDate-endDate is created instead. Single-day events and showEndsOnlyWithDuration: true keep the old behaviour.

relative: Added the same end-date append that already existed for timed events - after the TODAY/TOMORROW/etc. label the end date is appended for multi-day full-day events.

absolute + nextDaysRelative: The start date gets replaced by a relative label, but the end date was never appended afterwards. Fixed that. I introduced a small relativeLabel flag to make sure the end date is only added when a relative label actually replaced the start - otherwise events outside the relative range would have shown the end date twice.

Before

bildo

After

bildo

…eFormats

showEnd: true now works for full-day events spanning multiple days in
'relative' and 'dateheaders' mode, not just 'absolute'. Also, when
nextDaysRelative replaces the start with 'Tomorrow' etc., the end date
is appended (e.g. 'Tomorrow - 17th Mar'). showEndsOnlyWithDuration
suppresses the end date as expected.

Closes MagicMirrorOrg#4053
@kkangshawn
Copy link

Hi @KristjanESPERANTO , thank you for your interest and work. I verified your patch and confirmed it works perfectly with fullday event. However, this doesn't show the end for the 'Multiday events with time(full day not checked)', e.g. from 10:00AM 30.03.2026 to 11:00AM 02.04.2026 .
I'd appreciate it if you also consider this kind of events.

@KristjanESPERANTO
Copy link
Collaborator Author

KristjanESPERANTO commented Mar 15, 2026

Thanks for testing and for the feedback! 🙂

I just added showEnd handling for timed multi-day events in relative/dateheaders as well. The exact end output is controlled by dateEndFormat (same behavior as in absolute mode).

By default dateEndFormat is LT, so only the end time is shown. If you want end date + time, set for example:
dateEndFormat: "MMM Do, HH:mm"

bildo

What do you think of it?

Add electron test coverage for timed (non-full-day) multi-day events with
showEnd enabled in `relative` and `dateheaders` modes.

Use a yearly recurring mock ICS so tests stay stable over time and avoid
"no upcoming events" failures as dates move on.
Log.info("[calendar] not full day but within getRelative size");
// If event is within getRelative hours, display 'in xxx' time format or moment.fromNow()
timeWrapper.innerHTML = `${CalendarUtils.capFirst(eventStartDateMoment.fromNow())}`;
} else if (this.config.showEnd && (!this.config.showEndsOnlyWithDuration || event.startDate !== event.endDate)) {
Copy link

@kkangshawn kkangshawn Mar 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @KristjanESPERANTO for the quick response! And additional functionality for dateEndFormat as well.
This works perfectly with the corner case which is the multiple day with specific time values.

Luckily or not, I found this line affects the existing behavior. The single day event is showing the end date even though the start date and the end date are same.

Image

I am not sure if this is expected behavior but this line seems like it is supposed to show the end date when the startDate and endDate are different. From my debugging, the event.startDate !== event.endDate returns always true even if the dates are same. (Please see the reds above)

For draft, I checked below code fits this case. I'd appreciate it if you check this once again.

} else if (this.config.showEnd && (!this.config.showEndsOnlyWithDuration && !eventStartDateMoment.isSame(eventEndDateMoment, "d"))) {

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see your point. I need to think this through more deeply.

@KristjanESPERANTO KristjanESPERANTO marked this pull request as draft March 15, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants