Show date_to in PDF variable "event_date_range" regardless of event settings

Z#2349533
This commit is contained in:
Raphael Michel
2019-07-16 09:31:40 +02:00
parent a79a156a28
commit 44ffc0685e
2 changed files with 3 additions and 3 deletions

View File

@@ -100,14 +100,14 @@ class EventMixin:
"DATETIME_FORMAT" if self.settings.show_times else "DATE_FORMAT"
)
def get_date_range_display(self, tz=None) -> str:
def get_date_range_display(self, tz=None, force_show_end=False) -> str:
"""
Returns a formatted string containing the start date and the end date
of the event with respect to the current locale and to the ``show_times`` and
``show_date_to`` settings.
"""
tz = tz or self.timezone
if not self.settings.show_date_to or not self.date_to:
if (not self.settings.show_date_to and not force_show_end) or not self.date_to:
return _date(self.date_from.astimezone(tz), "DATE_FORMAT")
return daterange(self.date_from.astimezone(tz), self.date_to.astimezone(tz))

View File

@@ -114,7 +114,7 @@ DEFAULT_VARIABLES = OrderedDict((
("event_date_range", {
"label": _("Event date range"),
"editor_sample": _("May 31st June 4th, 2017"),
"evaluate": lambda op, order, ev: ev.get_date_range_display()
"evaluate": lambda op, order, ev: ev.get_date_range_display(force_show_end=True)
}),
("event_begin", {
"label": _("Event begin date and time"),