Skip to content

Commit

Permalink
Deal with cases where DTEND is not given in the event dict (#2024)
Browse files Browse the repository at this point in the history
Fixes #2021.

Co-authored-by: Jacob Coffee <jacob@z7x.org>
  • Loading branch information
malemburg and JacobCoffee authored Sep 13, 2024
1 parent ee0a7da commit 74e659c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion events/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,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 = (
Expand Down

0 comments on commit 74e659c

Please sign in to comment.