collective / icalendar

icalendar parser library for Python

Home Page:https://icalendar.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with Event rrule format

tyctor opened this issue · comments

trying to create recuring event, but export to ical fails:

event = icalendar.Event()
event.add("rrule", {'FREQ': 'MONTHLY', 'WKST': 'MO', 'BYDAY': '+1TU,+3TU'})
event.to_ical()

...
ValueError: Expected weekday abbrevation, got: +1TU,+3TU

but icalendar validator on https://icalendar.org/validator.html claims that this rrule is valid

Thanks for reporting this! You would probably expect the event to be created. What would the valid rrule string or ics string look like?

hi,
valid rrule string should be
RRULE:FREQ=MONTHLY;WKST=MO;BYDAY=+1TU,+3TU

in words
Every month on the 1st Tuesday and 3rd Tuesday

oh, understand, value must be list

this is ok:

event = icalendar.Event()
event.add("rrule", {'FREQ': 'WEEKLY', 'WKST': 'MO', 'BYDAY': ['+1TU', '+3TU']})
event.to_ical()

b'BEGIN:VEVENT\r\nRRULE:FREQ=WEEKLY;BYDAY=+1TU,+3TU;WKST=MO\r\nEND:VEVENT\r\n'