Skip to content

Throws UNTIL rule part MUST have the same value type as DTSTART #435

@runely

Description

@runely

Up until node-ical v0.22.1 parsing went fine.

With node-ical v0.23.1 it has started throwing UNTIL rule part MUST have the same value type as DTSTART.

I know this is comming from rrule-temporal, but it seems that the problem is how node-ical calls upon rrule-temporal.

With the ics event shown below, node-ical throws UNTIL rule part MUST have the same value type as DTSTART via rrule-temporal.

However, when using the rrule-temporal Playground and inserting the DTSTART and the RRULE in the Raw section, it doesn't complain:

DTSTART;VALUE=DATE:20231027
RRULE:FREQ=WEEKLY;UNTIL=20240523

Ics event:

BEGIN:VEVENT
DTSTART;VALUE=DATE:20231027
DTEND;VALUE=DATE:20231028
RRULE:FREQ=WEEKLY;UNTIL=20240523
EXDATE;VALUE=DATE:20240517
DTSTAMP:20260131T113350Z
UID:202B21E4-0844-44D2-ABA1-3528A7ABC85D
CREATED:20240508T202621Z
LAST-MODIFIED:20240523T065534Z
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:Test av gammal heldags Gmail recurr
TRANSP:OPAQUE
X-APPLE-CREATOR-IDENTITY:com.apple.mobilecal
X-APPLE-CREATOR-TEAM-IDENTITY:0000000000
END:VEVENT

The error thrown:

/Users/runely/sources/private/calendar-homey-test/node_modules/rrule-temporal/dist/index.cjs:197
          throw new Error("UNTIL rule part MUST have the same value type as DTSTART");
          ^

Error: UNTIL rule part MUST have the same value type as DTSTART
    at parseRRuleString (/Users/runely/sources/private/calendar-homey-test/node_modules/rrule-temporal/dist/index.cjs:197:17)
    at new _RRuleTemporal (/Users/runely/sources/private/calendar-homey-test/node_modules/rrule-temporal/dist/index.cjs:258:22)
    at Object.END (/Users/runely/sources/private/calendar-homey-test/node_modules/node-ical/ical.js:891:33)
    at Object.handleObject (/Users/runely/sources/private/calendar-homey-test/node_modules/node-ical/ical.js:944:39)
    at Object.parseLines (/Users/runely/sources/private/calendar-homey-test/node_modules/node-ical/ical.js:996:18)
    at Immediate.<anonymous> (/Users/runely/sources/private/calendar-homey-test/node_modules/node-ical/ical.js:1011:16)
    at process.processImmediate (node:internal/timers:504:21)

When adding a try/catch around ical.js:891-896:

try {
  const rruleTemporal = new RRuleTemporal({
    rruleString: rruleOnly,
    dtstart: dtstartTemporal,
  });

  curr.rrule = new RRuleCompatWrapper(rruleTemporal);
} catch (_err) {
  console.error(`[node-ical] Failed to parse RRULE: '${rruleOnly}' with dtstartTemporal: '${dtstartTemporal.toString()}' with original DTSTART: '${curr.start}' on UID: '${curr.uid}'`);
  throw _err;
}

it console errors out this:

[node-ical] Failed to parse RRULE: 'FREQ=WEEKLY;UNTIL=20240523' with dtstartTemporal: '2023-10-27T00:00:00+00:00[UTC]' with original DTSTART: 'Fri Oct 27 2023 00:00:00 GMT+0000 (Coordinated Universal Time)' on UID: '202B21E4-0844-44D2-ABA1-3528A7ABC85D'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions