Describe the bug
I've found the following event in the wild and it make the library crash on it becasue DTSTART is a date and DTEND is a datetime.
Possibly it is a invalid event, but it exists and the library is crashing even with skip_bad_series=True
ICS file
BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTART;VALUE=DATE:20230724
CREATED:20230606T153716Z
STATUS:CONFIRMED
SUMMARY:Congés
TRANSP:TRANSPARENT
DTSTAMP:20230704T085547Z
DTEND:20230817T000000Z
SEQUENCE:1
LAST-MODIFIED:20230731T161724Z
UID:19970901T130000Z[email protected]
END:VEVENT
END:VCALENDAR
Expected behavior
Event processed or event skipped (if skip_bad_series)
Tried to import the ics to Gnome Evolution and it take it without problem.
Console output
Traceback (most recent call last):
File "xxx.py", line 49, in yyy
...
^^^^^^^^^^^^^^^^^^^^^^^^
File "xxx.py", line 104, in yyy
zzz = recurring_ical_events.of(calendar, skip_bad_series=True).between(start_date, end_date)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.12/site-packages/recurring_ical_events.py", line 1446, in of
return calendar_query(
^^^^^^^^^^^^^^^
File "/venv/lib/python3.12/site-packages/recurring_ical_events.py", line 1290, in __init__
component_adapter.collect_series_from(calendar, self._skip_errors)
File "/venv/lib/python3.12/site-packages/recurring_ical_events.py", line 1191, in collect_series_from
result.append(self._series(components))
^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.12/site-packages/recurring_ical_events.py", line 610, in __init__
self.compute_span_extension()
File "/venv/lib/python3.12/site-packages/recurring_ical_events.py", line 615, in compute_span_extension
self.recurrence.extend_query_span_by
File "/venv/lib/python3.12/site-packages/recurring_ical_events.py", line 413, in extend_query_span_by
return self.core.extend_query_span_by
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.12/site-packages/recurring_ical_events.py", line 259, in cached_property
self.__dict__[name] = value = func(self)
^^^^^^^^^^
File "/venv/lib/python3.12/site-packages/recurring_ical_events.py", line 884, in extend_query_span_by
subtract_from_start = self.duration
^^^^^^^^^^^^^
File "/venv/lib/python3.12/site-packages/recurring_ical_events.py", line 259, in cached_property
self.__dict__[name] = value = func(self)
^^^^^^^^^^
File "/venv/lib/python3.12/site-packages/recurring_ical_events.py", line 865, in duration
return self.end - self.start
~~~~~~~~~^~~~~~~~~~~~
TypeError: unsupported operand type(s) for -: 'datetime.datetime' and 'datetime.date'
Version:
pip list
Additional context
Suggested implementation
@cached_property
def duration(self) -> datetime.timedelta:
"""The duration of the component."""
start, end = make_comparable((self.start, self.end))
return end - start
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