diff --git a/events/importer.py b/events/importer.py index e47775060..fe04d35f5 100644 --- a/events/importer.py +++ b/events/importer.py @@ -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 = ( diff --git a/events/models.py b/events/models.py index 23269884d..1f2ab2cb0 100644 --- a/events/models.py +++ b/events/models.py @@ -244,7 +244,7 @@ class OccurringRule(RuleMixin, models.Model): def __str__(self): strftime = settings.SHORT_DATETIME_FORMAT - return f'{self.event.title} {date(self.dt_start.strftime, strftime)} - {date(self.dt_end.strftime, strftime)}' + return f'{self.event.title} {date(self.dt_start, strftime)} - {date(self.dt_end, strftime)}' @property def begin(self): @@ -290,8 +290,8 @@ class RecurringRule(RuleMixin, models.Model): all_day = models.BooleanField(default=False) def __str__(self): - strftime = settings.SHORT_DATETIME_FORMAT - return f'{self.event.title} every {timedelta_nice_repr(self.interval)} since {date(self.dt_start.strftime, strftime)}' + return (f'{self.event.title} every {timedelta_nice_repr(self.freq_interval_as_timedelta)} since ' + f'{date(self.dt_start, settings.SHORT_DATETIME_FORMAT)}') def to_rrule(self): return rrule( diff --git a/templates/base.html b/templates/base.html index b9f3df9c6..578dc1204 100644 --- a/templates/base.html +++ b/templates/base.html @@ -66,7 +66,7 @@ {# Tile icon for Win8 (144x144 + tile color) #} - +