{% set today= "now"|date("Y-m-d") %} {% set found1Tama = 0 %} {% for discount in discounts %} {% if (discount.getDiscounts().getDateStart()|date("Y-m-d") <= today and discount.getDiscounts().getDateEnd()|date("Y-m-d") >= today) or (discount.getDiscounts().getDateStart()|date("Y-m-d") <= today and discount.getDiscounts().getDateEnd() is null) %} {% set found1Tama = found1Tama + 1 %} {% endif %} {% endfor %} {% if discounts | length > 0 and found1Tama > 0 %} {% for discount in discounts %} {% if loop.index == found1Tama %}