-
Notifications
You must be signed in to change notification settings - Fork 0
Recurrence rule (RRULE) support #5
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Problem
Recurrence rules (RRULE) have complex syntax and semantics. Current implementation treats them as simple strings which may lead to invalid rules.
RRULE Complexity
RRULE:FREQ=WEEKLY;BYDAY=MO,WE,FR;COUNT=10
RRULE:FREQ=MONTHLY;BYMONTHDAY=1,15;UNTIL=20251231T235959Z
RRULE:FREQ=YEARLY;BYMONTH=1;BYDAY=1MOCurrent Behavior
// Accepts any string - may create invalid RRULE
updateFields(event, {
'RRULE': 'FREQ=WEEKLY;BYDAY=MO,WE,FR'
});Related Operations
- Expanding recurring events
- Handling EXDATE (exception dates)
- RDATE (additional dates)
- Modifying single occurrences
Philosophy
RRULE manipulation and expansion is complex business logic that doesn't belong in this utility library.
Recommendation
Users should:
- Use ical.js Recur class for RRULE manipulation
- Use application logic for recurrence expansion
- Use tsdav-utils only for non-recurrence properties
Workaround
Using ical.js for RRULE
import ICAL from 'ical.js';
// Create recurrence rule
const recur = new ICAL.Recur({
freq: 'WEEKLY',
byday: ['MO', 'WE', 'FR'],
count: 10
});
const component = new ICAL.Component(ICAL.parse(event.data));
const vevent = component.getFirstSubcomponent('vevent');
// Set RRULE
vevent.updatePropertyWithValue('rrule', recur);
// Update other fields with tsdav-utils
const updated = updateFields(component.toString(), {
'SUMMARY': 'Recurring Meeting'
});Expanding Recurring Events
import ICAL from 'ical.js';
const component = new ICAL.Component(ICAL.parse(event.data));
const vevent = component.getFirstSubcomponent('vevent');
const event = new ICAL.Event(vevent);
// Expand recurrences
const expand = new ICAL.RecurExpansion({
component: vevent,
dtstart: event.startDate
});
const next10 = [];
for (let i = 0; i < 10; i++) {
next10.push(expand.next());
}Related
- RFC 5545 Section 3.3.10 (Recurrence Rule)
- RFC 5545 Section 3.8.5.2 (EXDATE)
- RFC 5545 Section 3.8.5.3 (RDATE)
- ical.js Recur documentation
- ical.js RecurExpansion documentation
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request