Answers.Body: <p>Was missing the square brackets </p>
  
  <pre><code>{% set groupedEvents = craft.entries(params).eventDate(['and', '&gt;= ' ~ startdate, '&lt;= ' ~ enddate]) | group('eventDate|date("Y-m-d")') %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-15T22:16:47.340Z
Answers.Text: 100%. Need to wait 18 hours before I can accept that as answer.
Answers.UserDisplayName: mmc501
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-15T04:29:55.637Z
Answers.LastActivityDate: 2018-06-15T04:29:55.637Z
Answers.UserDisplayName: mmc501
Body: <p>On a website upgraded to Craft 3 - having issues pulling events by date.</p>
  
  <p>Error Is:</p>
  
  <pre><code>Calling unknown method: craft\behaviors\ElementQueryBehavior::eventDate()
  </code></pre>
  
  <p>The Error occurs on the last line of my code below.
  I'm done alot of searching but unable to find the correct method I should be using now.</p>
  
  <pre><code>    {% if (category is defined) and (category is not empty) %}
      {% set params = { section: 'events', orderBy: 'eventDate', relatedTo: category } %}
      {% else %}
      {% set params = { section: 'events', orderBy: 'eventDate' } %}
      {% endif %}          
      {% set j = 0 %}
      {# Retrieve all of the events for the month, and group them by day #}
      {% set groupedEvents = craft.entries(params).eventDate('and', '&gt;= ' ~ startdate, '&lt;= ' ~ enddate) | group('eventDate|date("Y-m-d")') %}
  </code></pre>
  
  <p><strong>UPDATE</strong>
  Ok think found the issue - needed square brackets.</p>
  
  <pre><code>{% set groupedEvents = craft.entries(params).eventDate(['and', '&gt;= ' ~ startdate, '&lt;= ' ~ enddate]) | group('eventDate|date("Y-m-d")') %}
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-06-14T23:34:05.400Z
Comments.Text: Glad you got it sorted!  Would you mind adding that as an official answer in case it ends up helping someone in the future?
Comments.UserDisplayName: Brad Bell
Tags: <templating><craft3><elementquery>
Title: Craft 3 - Searching by date field - Calling unknown method: craft\behaviors\ElementQueryBehavior
ThreadText: # Craft 3 - Searching by date field - Calling unknown method: craft\behaviors\ElementQueryBehavior
  
  (Asked by: username_0 on 2018-06-14)
  
  On a website upgraded to Craft 3 - having issues pulling events by date.
  
  Error Is:
  
  ```
  Calling unknown method: craft\behaviors\ElementQueryBehavior::eventDate()
  
  ```
  
  The Error occurs on the last line of my code below.
  I'm done alot of searching but unable to find the correct method I should be using now.
  
  ```
      {% if (category is defined) and (category is not empty) %}
      {% set params = { section: 'events', orderBy: 'eventDate', relatedTo: category } %}
      {% else %}
      {% set params = { section: 'events', orderBy: 'eventDate' } %}
      {% endif %}          
      {% set j = 0 %}
      {# Retrieve all of the events for the month, and group them by day #}
      {% set groupedEvents = craft.entries(params).eventDate('and', '>= ' ~ startdate, '<= ' ~ enddate) | group('eventDate|date("Y-m-d")') %}
  
  ```
  
  **UPDATE**
  Ok think found the issue - needed square brackets.
  
  ```
  {% set groupedEvents = craft.entries(params).eventDate(['and', '>= ' ~ startdate, '<= ' ~ enddate]) | group('eventDate|date("Y-m-d")') %}
  
  ```
  
  **Tags:** templating, craft3, elementquery
  
  > **Comments:**
  > **username_1**: Glad you got it sorted!  Would you mind adding that as an official answer in case it ends up helping someone in the future?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-06-15. Score: 2 | Accepted answer
  
  Was missing the square brackets
  
  ```
  {% set groupedEvents = craft.entries(params).eventDate(['and', '>= ' ~ startdate, '<= ' ~ enddate]) | group('eventDate|date("Y-m-d")') %}
  
  ```
  
  > **Comments:**
  > **username_0**: 100%. Need to wait 18 hours before I can accept that as answer.  
  
  ---
  
  