Agenda box needs both Start Date and End Date in order to display on of them
Summary
For some reason the Agenda Box pattern requires both Start Date and End Date in order to display one of them.
Steps to reproduce
- Create a display that uses Agenda Box pattern
- Add only Start Date without End Date
- Save and notice that Start Date is not displayed
Possible fixes
In agenda-box.html.twig
the following code defines start_date:
{% if start_date | render and end_date | render %}
<div class="agenda-box-date-wrapper" {{ attributes_textcolor }}>
<span class="agenda-box-week-day">{{ start_date|format_date_field('custom', 'l') }}</span>
<div class="agenda-box-event-dates">
<span class="agenda-box-event-dates-1">{{ start_date|format_date_field('custom', 'j') }}</span> <span class="agenda-box-event-dates-2">{{ start_date|format_date_field('custom', 'M') }}</span><span class="agenda-box-event-dates-3">/{{ start_date|format_date_field('custom', 'y') }}</span>
</div>
<div class="agenda-box-event-time">
<span class="agenda-box-start-time">
{{ start_date|format_date_field('custom', 'H:i') }}
{% if start_date | format_date_field('custom', 'j M') == end_date | format_date_field('custom', 'j M') %}
-
{{ end_date|format_date_field('custom', 'H:i') }}
{% endif %}
</span>
{% if timezone | render %}
<span class="agenda-box-time-zone">({{ timezone }})</span>
{% endif %}
<br/>
{% if start_date | format_date_field('custom', 'j M') != end_date | format_date_field('custom', 'j M') %}
<span>
<b>{{ 'Ends:' | t | upper }}</b>
</span>
<b>{{ end_date }}</b>
{% endif %}
</div>
</div>
{% endif %}
As you can see in order to render the start_date, it requires the end_date to be present. Change it.
Edited by Konstantinos Platis