Skip to content

Conversation

@KristjanESPERANTO
Copy link
Collaborator

Adapts calendar module to node-ical changes and fixes a bug with moved full-day recurring events in eastern timezones.

Changes

1. Update node-ical to 0.23.1

2. Remove dead code

  • Removed ineffective UNTIL modification code (rule.options is read-only in rrule-temporal)
  • The code attempted to extend UNTIL for all-day events but had no effect

3. Fix recurrence lookup for full-day events

node-ical changed the behavior of getDateKey() - it now uses local date components for VALUE=DATE events instead of UTC. This broke recurrence override lookups for full-day events in eastern timezones.

Why it broke:

  • before node-ical update: Both node-ical and MagicMirror used UTC → keys matched ✅
  • after node-ical update: node-ical uses local date (RFC 5545 conform), MagicMirror still used UTC → mismatch

Example:

  • Full-day recurring event on October 12 in Europe/Berlin (UTC+2)
  • node-ical 0.23.1 stores override with key: "2024-10-12" (local date)
  • MagicMirror looked for key: "2024-10-11" (from UTC: Oct 11 22:00)
  • Result: Moved event not found, appears on wrong date

Solution: Adapt to node-ical's new behavior by using local date components for full-day events, UTC for timed events.

Note: This is different from previous timezone fixes - those addressed event generation, this fixes the lookup of recurrence overrides.

Background

node-ical 0.23.0 switched from rrule to rrule-temporal, introducing breaking changes. Version 0.23.1 fixed the UNTIL validation issue and formalized the getDateKey() behavior for DATE vs DATE-TIME values, following RFC 5545 specification that DATE values represent local calendar dates without timezone context.

Remove ineffective UNTIL modification and unnecessary tzid clearing.
Simplify timed event conversion. The removed code had no effect
because rule.options is a read-only getter in rrule-temporal.
…rn timezones

When looking up recurrence overrides (moved/modified instances), the dateKey
was always calculated from UTC time. This caused a mismatch for full-day
events in timezones east of UTC (e.g., Europe/Berlin).

Example:
- Full-day event on Oct 12 in Europe/Berlin (UTC+2)
- Old: dateKey = "2024-10-11" (from UTC: Oct 11 22:00)
- New: dateKey = "2024-10-12" (from local date components)

node-ical's getDateKey() uses local date components for VALUE=DATE events,
as per RFC 5545 specification. MagicMirror now matches this behavior.

This fixes moved full-day recurring events not being found in their
recurrence override table, causing them to appear on the wrong date.

Related: node-ical upgrade to 0.23.1
@sdetweil sdetweil merged commit 2d3a557 into MagicMirrorOrg:develop Jan 12, 2026
9 checks passed
@rejas
Copy link
Collaborator

rejas commented Jan 12, 2026

Thanks @KristjanESPERANTO this fixed my calendar again

@KristjanESPERANTO
Copy link
Collaborator Author

Great 🙂

The switch from rrule to rrule-temporal at node-ical was certainly the right strategic move, but it does come with some migration pains.

@KristjanESPERANTO KristjanESPERANTO deleted the calendar branch January 12, 2026 07:24
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.

3 participants