From 7701d2552534aee28ddbd09a4418297593cb586f Mon Sep 17 00:00:00 2001 From: Marc-Andre Lemburg Date: Fri, 8 Apr 2022 15:12:36 +0200 Subject: [PATCH] Deal with cases where DTEND is not given in the event dict. Fixes #2021. --- events/importer.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/events/importer.py b/events/importer.py index 847394fa0..77230d407 100644 --- a/events/importer.py +++ b/events/importer.py @@ -18,7 +18,13 @@ def import_occurrence(self, event, event_data): # but won't add any timezone information. We will convert them to # aware datetime objects manually. dt_start = extract_date_or_datetime(event_data['DTSTART'].dt) - dt_end = extract_date_or_datetime(event_data['DTEND'].dt) + if 'DTEND' in event_data: + # DTEND is not always set on events, in particular it seems that + # events which have the same start and end time, don't provide + # DTEND. See #2021. + dt_end = extract_date_or_datetime(event_data['DTEND'].dt) + else: + dt_end = dt_start # Let's mark those occurrences as 'all-day'. all_day = (