diff --git a/src/pretix/base/models/event.py b/src/pretix/base/models/event.py index 61ffbe9e8f..b4d103e1fb 100644 --- a/src/pretix/base/models/event.py +++ b/src/pretix/base/models/event.py @@ -65,7 +65,7 @@ class EventMixin: "SHORT_DATETIME_FORMAT" if self.settings.show_times else "DATE_FORMAT" ) - def get_date_from_display(self, tz=None, show_times=True) -> str: + def get_date_from_display(self, tz=None, show_times=True, short=False) -> str: """ Returns a formatted string containing the start date of the event with respect to the current locale and to the ``show_times`` setting. @@ -73,7 +73,7 @@ class EventMixin: tz = tz or self.timezone return _date( self.date_from.astimezone(tz), - "DATETIME_FORMAT" if self.settings.show_times and show_times else "DATE_FORMAT" + ("SHORT_" if short else "") + ("DATETIME_FORMAT" if self.settings.show_times and show_times else "DATE_FORMAT") ) def get_time_from_display(self, tz=None) -> str: @@ -86,7 +86,7 @@ class EventMixin: self.date_from.astimezone(tz), "TIME_FORMAT" ) - def get_date_to_display(self, tz=None) -> str: + def get_date_to_display(self, tz=None, short=False) -> str: """ Returns a formatted string containing the start date of the event with respect to the current locale and to the ``show_times`` setting. Returns an empty string @@ -97,7 +97,7 @@ class EventMixin: return "" return _date( self.date_to.astimezone(tz), - "DATETIME_FORMAT" if self.settings.show_times else "DATE_FORMAT" + ("SHORT_" if short else "") + ("DATETIME_FORMAT" if self.settings.show_times else "DATE_FORMAT") ) def get_date_range_display(self, tz=None, force_show_end=False) -> str: