Skip to content

feat(recur): add bymonth property accessor to vRecur (#1851) - #2171

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

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

Conversation

@RishabhIIITD

Copy link
Copy Markdown

Description

This PR implements the bymonth property accessor on :class:~icalendar.prop.recur.recur.vRecur as part of the #1851 collaboration.

Per RFC 5545 Section 3.3.10 and RFC 7529:

  • BYMONTH specifies a list of months of the year. Valid values are between 1 and 12 (or leap months such as 5L).
  • If multiple values are given, they all are returned as a tuple of :class:~icalendar.prop.recur.month.vMonth objects (tuple[vMonth, ...]).
  • If missing or an empty list is present, () is returned.
  • Setting to None or an empty sequence deletes the value (del recur.bymonth).
  • Values out of range (< 1 or > 12) raise InvalidCalendar.
  • Non-month types raise TypeError.

Implementation Checklist

  • return type is tuple[vMonth, ...] based on vRecur.types
  • setting to None or an empty sequence deletes the value
  • del deletes the value
  • if multiple values are given, they all are returned
  • if an empty list is in there, () is returned
  • docstring with example values: >>> vRecur.from_ical("FREQ=YEARLY;BYMONTH=1,6,12").bymonth
  • docstring summarizes what this property is about
  • docstring shows the valid range (1 to 12, plus leap months per RFC 7529)
  • unit tests in src/icalendar/tests/prop/recur/test_bymonth.py
  • news fragment added: news/1851.feature.6

@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