0

I'm trying to set a variable to a Matrix field and apply additional query parameters like so:

{% set monthDates = entry.scanDates.type('dates').date('and', '>= ' ~ currMonthFirst|date('Y-m-d'), '< ' ~ nextMonthFirst|date('Y-m-d')) %}

I want to have a set of dates based on a date range, but I'm getting a "Calling unknown method: craft\behaviors\ElementQueryBehavior::date()"

The name of the Matrix field is scanDates with block type dates and field name date.

The following code with just one parameter works just fine, so it must be the syntax that is wrong in the first example.

{% set monthDates = entry.scanDates.type('dates').date('>= ' ~ nextMonthFirst|date('Y-m-d')) %}

What is the correct syntax to narrow down the results based on multiple conditions? `

  • I am having the same issue—did you ever find a solution? Thanks. – univers_ May 16 at 15:05
  • @univers_ I wasn't able to figure out why it wasn't working so I found a different way to do what I need. – SoHo May 18 at 0:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.