Skip to content

Conversation

@KristjanESPERANTO
Copy link
Collaborator

Updating node-ical and adapt logic to new behaviour.

Problem

node-ical 0.23.0 switched from rrule.js to rrule-temporal, changing how recurring event dates are returned. Our code assumed the old behavior where dates needed manual timezone conversion.

Solution

Updated getMomentsFromRecurringEvent() in calendarfetcherutils.js:

  • Removed tzid = null clearing (no longer needed)
  • Simplified timed events: moment.tz(date, eventTimezone) instead of moment.tz(date, "UTC").tz(eventTimezone, true)
  • Kept UTC component extraction for full-day events to prevent date shifts

Adapt getMomentsFromRecurringEvent to work with node-ical 0.23.0's
new rrule-temporal implementation. Date objects now represent the
correct instant and can be directly converted to moments in the
event timezone, without manual UTC interpretation.

Fixes 16 failing tests for recurring events and DST handling.
@khassel
Copy link
Collaborator

khassel commented Jan 10, 2026

I am too far away from calendar stuff, so one of the other two should review and merge this.

@sdetweil sdetweil merged commit 3b793bf into MagicMirrorOrg:develop Jan 11, 2026
9 checks passed
@rejas
Copy link
Collaborator

rejas commented Jan 11, 2026

This somehow broke my calendar, now all I get is

[2026-01-11 16:55:06.911] [ERROR] [calendar] Calendar Error. Could not fetch calendar: https://xxxxxxx.de/caldav/kalender/home/ Error: UNTIL rule part MUST always be specified as a date with UTC time

@sdetweil
Copy link
Collaborator

can u add

,"DEBUG"

to logLevel property
and run

npm start >somefile.txt

and find the error and what event it is

and then

curl -sL your calurl >somefile.txt

and edit the somefile.txt to find the VEVENT for that event..

and share that when your timezone..

I don't see that error on my calendar (using develop)

@sdetweil
Copy link
Collaborator

you did npm install again after pulling develop, as it changes the node-ical dependency which this is based off of

@KristjanESPERANTO KristjanESPERANTO deleted the node-ical branch January 11, 2026 18:02
@KristjanESPERANTO
Copy link
Collaborator Author

KristjanESPERANTO commented Jan 11, 2026

Error: UNTIL rule part MUST always be specified as a date with UTC time

This comes from rrule-temporal.

I am now quite sure what the problem is: node-ical has switched from rrule to rrule-temporal. rrule was more lenient, but rrule-temporal correctly enforces RFC 5545, which now has to be intercepted on the parser side. I have created a PR for this: jens-maus/node-ical#428

@rejas Could you still show us the UNTIL entry?

sdetweil pushed a commit that referenced this pull request Jan 12, 2026
… lookup (#4013)

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
- Includes upstream fixes for UNTIL UTC validation errors from CalDAV
servers (reported by @rejas in PR #4010)
- Changes to `getDateKey()` behavior for VALUE=DATE events (now uses
local date components)
- Fixes issue with malformed DURATION values (reported by MagicMirror
user here: jens-maus/node-ical#381)

### 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.
@rejas
Copy link
Collaborator

rejas commented Jan 12, 2026

Sorry for not answering yesterday, had to entertain the kids ;-)

Anyway, 0.23.1 fixes my bug and the calendar shows up again.

Do you still need the Event from my calendar to see?

@KristjanESPERANTO
Copy link
Collaborator Author

Only if it doesn't involve too much effort. I'd just be curious to see what UNTIL looks like and which server violating RFC 5545. If it's an open source server, I would take a closer look at it - or open an issue at least.

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.

4 participants