Skip to content

Commit 74e659c

Browse files
Deal with cases where DTEND is not given in the event dict (#2024)
Fixes #2021. Co-authored-by: Jacob Coffee <[email protected]>
1 parent ee0a7da commit 74e659c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

events/importer.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ def import_occurrence(self, event, event_data):
2222
# but won't add any timezone information. We will convert them to
2323
# aware datetime objects manually.
2424
dt_start = extract_date_or_datetime(event_data['DTSTART'].dt)
25-
dt_end = extract_date_or_datetime(event_data['DTEND'].dt)
25+
if 'DTEND' in event_data:
26+
# DTEND is not always set on events, in particular it seems that
27+
# events which have the same start and end time, don't provide
28+
# DTEND. See #2021.
29+
dt_end = extract_date_or_datetime(event_data['DTEND'].dt)
30+
else:
31+
dt_end = dt_start
2632

2733
# Let's mark those occurrences as 'all-day'.
2834
all_day = (

0 commit comments

Comments
 (0)