forked from CGM_Public/pretix_original
Show end time in subevent list (Z#23237612)
This commit is contained in:
@@ -179,6 +179,12 @@ class EventMixin:
|
||||
self.date_to.astimezone(tz), ("D" if short else "l")
|
||||
)
|
||||
|
||||
def is_same_day(self):
|
||||
if not self.date_to:
|
||||
return True
|
||||
else:
|
||||
return self.date_from.astimezone(self.timezone).date() == self.date_to.astimezone(self.timezone).date()
|
||||
|
||||
def get_date_range_display(self, tz=None, force_show_end=False, as_html=False, try_to_show_times=False) -> str:
|
||||
"""
|
||||
Returns a formatted string containing the start date and the end date
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{% load i18n %}
|
||||
{% load icon %}
|
||||
{% load eventurl %}
|
||||
{% load date_fast %}
|
||||
|
||||
<div class="event-list full-width-list alternating-rows">
|
||||
{% for subev in subevent_list.subevent_list %}
|
||||
@@ -17,8 +18,14 @@
|
||||
<span data-time="{{ subev.date_from.isoformat }}" data-timezone="{{ event.timezone }}" data-time-short>
|
||||
{% icon "clock-o" %}
|
||||
<span class="sr-only">{% trans "Time of day" %}</span>
|
||||
<time datetime="{{ subev.date_from.isoformat }}">{{ subev.date_from|date:"TIME_FORMAT" }}</time>
|
||||
<time datetime="{{ subev.date_from|date_fast:"H:i" }}">{{ subev.date_from|date_fast:"TIME_FORMAT" }}</time>
|
||||
</span>
|
||||
{% if event.settings.show_date_to and subev.date_to and subev.is_same_day %}
|
||||
<span data-time="{{ subev.date_to.isoformat }}" data-timezone="{{ event.timezone }}" data-time-short>
|
||||
<span aria-hidden="true">–</span><span class="sr-only">{% trans "until" context "timerange" %}</span>
|
||||
<time datetime="{{ subev.date_to|date_fast:"H:i" }}">{{ subev.date_to|date_fast:"TIME_FORMAT" }}</time>
|
||||
</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</p>
|
||||
<p class="col-md-3 col-xs-6">
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
{% icon "clock-o" %}
|
||||
<span class="sr-only">{% trans "Time of day" %}</span>
|
||||
<time datetime="{{ e.date_from|date_fast:"H:i" }}">{{ e.date_from|date:"TIME_FORMAT" }}</time>
|
||||
{% if e.settings.show_date_to and e.date_to and e.date_to.date == e.date_from.date %}
|
||||
{% if e.settings.show_date_to and e.date_to and e.is_same_day %}
|
||||
<span aria-hidden="true">–</span><span class="sr-only">{% trans "until" context "timerange" %}</span>
|
||||
<time datetime="{{ e.date_to|date_fast:"H:i" }}">{{ e.date_to|date:"TIME_FORMAT" }}</time>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user