Skip to content

feat(recur): add bymonthday property accessor to vRecur (#1851) - #2175

Open
RishabhIIITD wants to merge 1 commit into
PyCalendar:mainfrom
RishabhIIITD:feat/recur-bymonthday-property
Open

RishabhIIITD wants to merge 1 commit into
PyCalendar:mainfrom
RishabhIIITD:feat/recur-bymonthday-property

Conversation

@RishabhIIITD

Copy link
Copy Markdown

Summary

Adds the bymonthday property accessor (getter, setter, and deleter) to icalendar.prop.vRecur in accordance with RFC 5545 Section 3.3.10.

Changes

  1. Getter (vRecur.bymonthday):

    • Returns a tuple[int, ...] containing the days of the month.
    • Returns () if BYMONTHDAY is absent or empty.
    • Rejects zero and values outside [-31, -1] or [1, 31] with InvalidCalendar.
    • Rejects boolean or non-integer values with InvalidCalendar.
  2. Setter (vRecur.bymonthday = value):

    • Accepts a single integer, an iterable of integers, or None (deletes the property).
    • Validates that values are within [-31, -1] or [1, 31] (zero is forbidden).
    • Setting to an empty sequence or None deletes BYMONTHDAY.
    • Rejects invalid types (bool, str, arbitrary objects) with TypeError.
    • Converts valid integers to vInt.
  3. Deleter (del recur.bymonthday):

    • Safely removes BYMONTHDAY if present.
  4. Tests & News:

    • Comprehensive test suite in src/icalendar/tests/prop/recur/test_bymonthday.py (27 test cases covering valid ranges, negatives, bounds, deletion, type/value error handling, and round-tripping).
    • Towncrier news fragment in news/1851.feature.9.

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the pull request, @RishabhIIITD! A maintainer will review it shortly.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant