|
- {# templates/_macros/helpers.html.twig #}
-
- {% macro smart_date(currentDate, todayStr, tomorrowStr, yesterdayStr, months, weekdays) %}
- {%- set activStr = currentDate|date('Y-m-d') -%}
- {%- set monthName = months[currentDate|date('n') - 1] -%}
- {%- if activStr == todayStr -%}
- {{ 'app.date.today'|trans }}, {{ currentDate|date('j') }}. {{ monthName }}
- {%- elseif activStr == tomorrowStr -%}
- {{ 'app.date.tomorrow'|trans }}, {{ currentDate|date('j') }}. {{ monthName }}
- {%- elseif activStr == yesterdayStr -%}
- {{ 'app.date.yesterday'|trans }}, {{ currentDate|date('j') }}. {{ monthName }}
- {%- else -%}
- {{ weekdays[currentDate|date('N') - 1] }}, {{ currentDate|date('j') }}. {{ monthName }}
- {%- endif -%}
- {% endmacro %}
|