I am looking to filter entries by a given month regardless of year. The filter would be based on a custom Date/Time input. My last goal would allow them to be paginated.
{% set firstDayOfMonth = year ~ "-" ~ month ~ "-01" %}
{% set daysInThisMonth = firstDayOfMonth|date('t') %}
{% set lastDayOfMonth = year ~ "-" ~ month ~ "-" ~ daysInThisMonth %}
{% set thisMonthsEntries = craft.entries.section('messages').messageDate('and', '>= ' ~ firstDayOfMonth, '<= ' ~ lastDayOfMonth) %}
{% paginate thisMonthsEntries as entriesOnPage %}
{% for entry in entriesOnPage %}
{# ... whatever your code does... #}
{% endfor %}
{% endpaginate %}
This is my original code. My first guess is I would need to have an array of years and loop through each year applying to the above code, however I am unclear on how to get a unique list of years that my entries are related too. Then I would probably have multiple sets of entries which would then need to be merged some how for output.