Describe the bug
Some calendars in the wild contain events with end datetime before start datetime.
(Seen with Sogo as calendar provider)
It make the library crash because of an assertion in Repetition.init ensuring the good order.
ICS file
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//SabreDAV//SabreDAV//EN
CALSCALE:GREGORIAN
X-WR-CALNAME:test
X-APPLE-CALENDAR-COLOR:#e78074
BEGIN:VTIMEZONE
TZID:Europe/Berlin
X-LIC-LOCATION:Europe/Berlin
BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
CREATED:20190303T111937
DTSTAMP:20190303T111937
LAST-MODIFIED:20190303T111937
UID:UYDQSG9TH4DE0WM3QFL2J
SUMMARY:test1
DTEND;TZID=Europe/Berlin:20190304T080000
DTSTART;TZID=Europe/Berlin:20190304T083000
END:VEVENT
END:VCALENDAR
Workaround
Currently, I have to monkey patch Repetiton
class to override init method to invert start stop when needed (it is ok for what I need, but may not be suitable for others app use-cases)
def fix_start_end_order_in_repetition_init(original_init):
def fixed_init(self, source, start, stop, *args, **kwargs):
if stop < start:
(start, stop) = (stop, start)
return original_init(self, source, start, stop, *args, **kwargs)
return fixed_init
recurring_ical_events.Repetition.__init__ = fix_start_end_order_in_repetition_init(
recurring_ical_events.Repetition.__init__
)
Version:
Suggested implementation
Maybe it should be nice to offer a proper way to customize the library. For example, allow to passe custom classes to replace the default ones.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too