I need to be able to group dates by their month but then order them by month too because the order they're inserted into the database in na super field table isn't always in date order.
So far, I have this:
{% set today = now|date('U') %}
{% set dates = [] %}
{% for date in entry.dates %}
{% if date.start|date('U') >= today %}
{% set dates = dates|merge([date]) %}
{% endif %}
{% endfor %}
{% set datesByMonth = dates|group('start|date("F Y")') %}
{% for month, dates in datesByMonth %}
{{ month }}
dates stuff
{% endfor %}
which works fine except for the ordering.
I thought for the ordering, I might be able to do this:
{% for month, dates in datesByMonth|multisort(['start|date("c")']) %}
…
{% endfor %}
but that doesn't change the order. Am I doing that wrong or is there another way?
dates
variable - entries,DateTime
values?