diff --git a/AKModel/models.py b/AKModel/models.py index 8eae767ae8a393bfcef1cacd9d919464e60cc0f7..ff005a7ac2c738dd6276f18395ba50529e509025 100644 --- a/AKModel/models.py +++ b/AKModel/models.py @@ -348,11 +348,17 @@ class AKSlot(models.Model): @property def time_simplified(self): """ - Display start and end time of slot in format weekday + time, e.g. "Fri 14:00 - 15:30" + Display start and end time of slot in format weekday + time, e.g. "Fri 14:00 - 15:30" or "Fri 22:00 - Sat 02:00" """ if self.start is None: return _("Not scheduled yet") - return self.start.astimezone(self.event.timezone).strftime('%a %H:%M') + ' - ' + self.end.astimezone(self.event.timezone).strftime('%H:%M') + result = self.start.astimezone(self.event.timezone).strftime('%a %H:%M') + result += ' - ' + if self.start.astimezone(self.event.timezone).day == self.end.astimezone(self.event.timezone).day: + result += self.end.astimezone(self.event.timezone).strftime('%H:%M') + else: + result += self.end.astimezone(self.event.timezone).strftime('%a %H:%M') + return result @property def end(self):