Skip to content

Commit 7701d25

Browse files
committed
Deal with cases where DTEND is not given in the event dict.
Fixes #2021.
1 parent ceb0bf9 commit 7701d25

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

events/importer.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ def import_occurrence(self, event, event_data):
1818
# but won't add any timezone information. We will convert them to
1919
# aware datetime objects manually.
2020
dt_start = extract_date_or_datetime(event_data['DTSTART'].dt)
21-
dt_end = extract_date_or_datetime(event_data['DTEND'].dt)
21+
if 'DTEND' in event_data:
22+
# DTEND is not always set on events, in particular it seems that
23+
# events which have the same start and end time, don't provide
24+
# DTEND. See #2021.
25+
dt_end = extract_date_or_datetime(event_data['DTEND'].dt)
26+
else:
27+
dt_end = dt_start
2228

2329
# Let's mark those occurrences as 'all-day'.
2430
all_day = (

0 commit comments

Comments
 (0)