fixup! Show end time in subevent list (Z#23237612)

This commit is contained in:
Kara Engelhardt
2026-07-15 12:54:35 +02:00
parent 56c112d23f
commit 4b289a7206
3 changed files with 8 additions and 2 deletions
+6
View File
@@ -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
@@ -20,7 +20,7 @@
<span class="sr-only">{% trans "Time of day" %}</span>
<time datetime="{{ subev.date_from|date_fast:"H:i" }}">{{ subev.date_from|date_fast:"TIME_FORMAT" }}</time>
</span>
{% if subev.event.settings.show_date_to and subev.date_to and subev.date_to.date == subev.date_from.date %}
{% 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>
@@ -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 %}