{# Pour format_date et les patterns de date,
cf. https://twig.symfony.com/doc/3.x/filters/format_datetime.html
cf. https://www.php.net/manual/en/intldateformatter.setpattern.php
cf. https://unicode-org.github.io/icu/
#}
{% if isAllEvents is not defined %}
{% set isAllEvents = false %}
{% endif %}
<div class="events-list{% if isAllEvents %} is-all-events{% endif %}">
{% for period in periods %}
{# {{ dump(thatDate) }}
{{ dump(period.periodStart|date('d/m/y')) }}
{{ dump(period.periodStart|date('d/m/y') != thatDate) }} #}
{# On redéfinit et on affiche thatDate si l'event ne commence pas le même jour que l'event précédent #}
{% if (thatDate is not defined) or (period.periodStart|date('d/m/y') != thatDate) %}
{% set thatDate = period.periodStart|date('d/m/y') %}
<p class="mt-3 mb-1 date">
{% if isAllEvents %}
{{ period.periodStart|format_date(pattern="EEEE d MMMM y")|capitalize }}
{% else %}
{{ period.periodStart|format_date(pattern="EEEE d MMMM")|capitalize }}
{% endif %}
</p>
{# pattern="EEE d MMMM y" donne Dim. 6 décembre 2020 #}
{% endif %}
<p class="mt-2 mb-2">
{% if period.event.important %}
<span class="badge badge-pill badge-danger">!</span>
{% endif %}
{% if period.allDay %}
~
{% else %}
{{ period.periodStart|date('H') }}h{{ period.periodStart|date('i') }}
{% endif %} : <a href="
{% if period.event.slug %}
{{ path('showEventBySlug', { slug : period.event.slug }) }}
{% else %}
{{ path('showEvent', { id : period.event.id }) }}
{% endif %}
">{{ period.event.title }}</a>
</p>
{% endfor %}
</div>