Planning

{% set weekPlanning = null %} {% for saison in saisons %} {% if saison.isActive == 0 or not saison_active_trouvee %} {% set saisonStartedAt = saison.saisonStartedAt|date("Y-m-d") %} {% set currentDate = "now"|date("Y-m-d") %} {% set startDate = date(saisonStartedAt) %} {% set endDate = date(currentDate) %} {% set interval = endDate.diff(startDate) %} {% set daysSinceStart = interval.days %} {% set weeksSinceStart = (daysSinceStart / 7)|round(0, 'ceil') %} {# Set test to the weeksSinceStart value based on specific criteria #} {% if saison.id == idSaison %} {% set weekPlanning = weeksSinceStart %} {% endif %} {# badge saison actif #} {% if saison.isActive == 1 %}
{% endif %} {{ saison.nom }}
{% endif %} {% endfor %}