Can't get {{ date_groups }} to work in v3

I can't seem to get {{ date_groups }} working in Statamic v3.

This works fine:

{{ collection:events sort="date" date:is_past="false" }}
    <h5>{{ date format="F Y"}}</h5>
    <p><b>{{ date format="l, F j, Y"}}</b> &mdash; {{ title }}</p>
{{ /collection:events }}

That produces something like this:

February 2021
Monday, February 22, 2021 — Event title 1

February 2021
Thursday, February 25, 2021 — Event title 2

March 2021
Wednesday, March 10, 2021 — Event title 3

March 2021
Monday, March 15, 2021 — Event title 4

I want to show these entries grouped by month, so like this:

February 2021
Monday, February 22, 2021 — Event title 1
Thursday, February 25, 2021 — Event title 2

March 2021
Wednesday, March 10, 2021 — Event title 3
Monday, March 15, 2021 — Event title 4

I should be able to do this using {{ date_groups }}. Looking at the v2 documentation at https://v2.statamic.com/tags/collection#group_by_date, I did this:

{{ collection:events sort="date" date:is_past="false" group_by_date="F Y" as="entries" }}
    {{ date_groups }}
        <h3>{{ date format="F Y"}}</h3>
        {{ entries }}
            <p><b>{{ date format="l, F j, Y"}}</b> &mdash; {{ title }}</p>
        {{ /entries }}
    {{ /date_groups }}
{{ /collection:events }}

But this produces nothing. I just see a blank page. I can't find anything on {{ date_groups }} in the v3 documentation at statamic.dev. Does {{ date_groups }} still exist in v3? If so, what am I doing wrong?

Thanks! --Ron

>>>>>>> Unanswered <<<<<<<
2 Replies
2 Followers