Skip to content

expandOccurrences with from shifts MONTHLY BYMONTHDAY=31,-31 grid #42

Closed

Description

@PhilflowIO

Symptom

Since 0.8.0 (PR #39), expandOccurrences with from returns other occurrences than the same call without from for at least one MONTHLY shape, both reported complete: true. PR #39 promises the filtered full result.

DTSTART;VALUE=DATE:19920630
RRULE:FREQ=MONTHLY;INTERVAL=5;BYMONTHDAY=31,-31
  • without from, until: '2029-01-01', filtered to 2026: 2026-07-01 2026-07-31 2026-12-01 2026-12-31
  • from: '2026-01-01', same until: 2026-03-01 2026-03-31 2026-08-01 2026-08-31

Cause, as far as read: DTSTART's month (June) holds neither the 31st nor day -31, so ical.js shifts its INTERVAL grid when walking from DTSTART (Jun 1992 -> Oct 1992 -> Mar 1993 ...). iterationStart moves the start by whole FREQ x INTERVAL periods, which assumes the grid never shifts. walkedInFull excludes YEARLY days not in every month, fifth weekdays and far BYSETPOS, but not a MONTHLY BYMONTHDAY list that can leave a month empty.

Probed and equal with and without from: BYMONTHDAY=31, =-31, =-30, =-29, =-1 alone (INTERVAL 1-5), MONTHLY from the 31st/30th/29th without BYMONTHDAY, YEARLY from 29 February, BYSETPOS=-1 over weekdays. Only the mixed 31,-31 list differed in that sample, so the exact boundary is unproven.

Found by PhilflowIO/dav-mcp's test "the 31st every fifth month" (__tests__/override-occurrences.test.js) while moving dav-mcp to 0.8.0.

Fix

  • Walk such MONTHLY rules from DTSTART (extend walkedInFull), or prove when the grid cannot shift.
  • The property test "with from equals the filtered result without it" should generate MONTHLY BYMONTHDAY lists above 28 and mixed signs, with INTERVAL > 1 and a DTSTART in a short month.

Activity

  1. added a commit that references this issue on Nov 18, 2026
    f1f2ef1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions