fix(calendar): make showEnd behavior more consistent across time formats (#4059)

Closes #4053

This started as a small fix.
After feedback and more debugging, I found more issues and
inconsistencies and went a bit down the rabbit hole.
The PR is bigger now, but I think the result is better: behavior is more
predictable, and the output is more consistent.

## Changes

- Multi-day full-day events now show an end date in `relative` and
`dateheaders` when `showEnd` is enabled.
- With `absolute` + `nextDaysRelative`, full-day events now keep the end
date when the start is replaced by TODAY/TOMORROW/etc.
- Timed events in `absolute` now also respect
`showEndsOnlyWithDuration`.
- Tests were expanded and refactored to cover more showEnd cases and
keep the setup easier to maintain.
- I also refactored parts of the calendar time rendering to reduce
duplicate logic.

## Before

<img width="1816" height="756" alt="before"
src="https://github.com/user-attachments/assets/ebec81fd-0c4a-4f9f-bbe3-e2b32ef6756e"
/>

## After

<img width="1816" height="756" alt="after"
src="https://github.com/user-attachments/assets/8a2c652d-dddc-4f6b-9074-fbef3411f9ed"
/>
This commit is contained in:
Kristjan ESPERANTO
2026-03-18 00:32:55 +01:00
committed by GitHub
parent d072345775
commit e1c44a86bb
7 changed files with 735 additions and 193 deletions

View File

@@ -0,0 +1,18 @@
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//MagicMirror Test//timed-multiday-yearly//EN
CALSCALE:GREGORIAN
BEGIN:VEVENT
DTSTART:20241026T010000Z
DTEND:20241026T110000Z
DTSTAMP:20241024T153358Z
UID:4maud6s79m41a99pj2g7j5km0a@google.com
CREATED:20241024T153313Z
LAST-MODIFIED:20241024T153330Z
SEQUENCE:0
STATUS:CONFIRMED
RRULE:FREQ=YEARLY
SUMMARY:Sleep over at Bobs
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR

View File

@@ -0,0 +1,18 @@
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//MagicMirror Test//timed-same-day-yearly//EN
CALSCALE:GREGORIAN
BEGIN:VEVENT
DTSTART:20241025T200000
DTEND:20241025T220000
DTSTAMP:20241024T153358Z
UID:timed-same-day-yearly@magicmirror
CREATED:20241024T153313Z
LAST-MODIFIED:20241024T153330Z
SEQUENCE:0
STATUS:CONFIRMED
RRULE:FREQ=YEARLY
SUMMARY:Same day timed event
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR