Filter Entries by Custom date I want to output all entries which match with a given year from a custom date field. The year is a string I get from slug. I am using Craft 3.5.16. What did I do wrong?
{% set catYear = craft.app.request.segment(-1) %}

{% set firstDayOfYear = now | date_modify('1 January ' ~ catYear) %}
{% set lastDayOfYear = now | date_modify('31 December ' ~ catYear) %}

{% set params = {
  section : 'termine',
  datumTermin : 'and, &gt;= ' ~ firstDayOfYear|date ~ ', &lt;= ' ~ lastDayOfYear|date
} %}

{% set beitrage = craft.entries(params).all %}
You need to query using strings and your condition should be written as follow:
{% set catYear = craft.app.request.segment(-1) %}

{% set firstDayOfYear = catYear ~ &quot;-01-01&quot; %}
{% set lastDayOfYear = catYear ~ &quot;-12-31&quot; %}


{% set params = {
    section : 'termine',
    datumTermin : ['and', '&gt;=' ~ firstDayOfYear, '&lt;= ' ~ lastDayOfYear]
} %}

{% set beitrage = craft.entries(params).all %}

See documentation for reference :)