This is strange. If I use {{ j }}, I get all 12 numbers, but adding the Twig date filter just echos out “Jan” twelve times.
How do I echo out all months of the year? Do I have a create an array instead?
<select>
{% for j in range(1, 12) %}
<option>{{ j|date('M') }}</option>
{% endfor %}
</select>
It’s because twig treats j as number of seconds from January 1970 (so it’s always January).
From twig documentation:
This should work: