Skip to content

RecurrenceEngineV2: BYSETPOS is a TODO stub #71

@thedhanawada

Description

@thedhanawada

Bug Description

RecurrenceEngineV2.getNextMonthly() (lines 305-308 in core/events/RecurrenceEngineV2.js) has a BYSETPOS branch that is effectively a no-op:

} else if (rule.bySetPos && rule.bySetPos.length > 0) {
    // BYSETPOS for selecting from set
    next.setMonth(next.getMonth() + rule.interval);
    // Complex BYSETPOS logic would go here
}

It advances the month but doesn't apply any BYSETPOS selection logic.

Impact

  • RRULE patterns using BYSETPOS (e.g., "last weekday of month") generate incorrect occurrences
  • This is a common pattern in corporate calendars (e.g., "last Friday of every month")
  • RFC 5545 compliance gap

Expected Fix

Implement BYSETPOS to:

  1. Generate the full set of candidate dates for the month based on other BY* rules
  2. Apply BYSETPOS indices to select from that set (supporting positive and negative indices)

Files

  • core/events/RecurrenceEngineV2.js:305-308

Metadata

Metadata

Assignees

No one assigned

    Labels

    phase:0-foundationImmediate fixes and test infrastructurepriority:highImportant for next milestonetype:bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions