Answers.Body: <p>Have you tried</p>
  
  <pre><code>.renewalDate('and', "&gt;= #{dateStart}", "&lt; #{dateEnd}")
  </code></pre>
  
  <p>The difference is the double quotes. I don't think that single quotes support interpolation.</p>
  
  <p>However, I'm not sure in that case why the version without the 'and' works.</p>
  
  <p>OK, have just tried it myself...
  I created a section called test and added a single date field called renewalDate and the code below works on a simple listing page.</p>
  
  <pre><code>{% set dateStart = now|date('Y-m-d H:i')  %}
  {% set dateEnd = date('next month') | date('Y-m-d H:i')  %}
  
  {% set params = {
    section : 'test',
    orderBy : 'renewalDate asc',
    renewalDate : ['and', "&gt;= #{dateStart}", "&lt; #{dateEnd}"]
  } %}
  
  &lt;h1&gt;Entries&lt;/h1&gt;
  {% for entry in craft.entries(params).all() %}
      &lt;p&gt;{{ entry.title }}&lt;/p&gt;
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-02T19:18:10.580Z
Answers.Text: Tried that but no luck - thanks, though!
Answers.UserDisplayName: Roi Agneta
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-02T23:29:02.943Z
Answers.Text: OK, have just tried it myself and have edited my answer with some actual working code. It's not exactly the same as yours but it's very close. Interestingly it only worked with double quotes. In my version the 'and' and two filters are in an array, so maybe that is what you need on your code.
Answers.UserDisplayName: JollyR
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-04T16:59:57.117Z
Answers.Text: Thanks @JollyR - I had tried using an array at one point, but guess I did not use double quote. Also, I checked the docs and there are a few examples that clearly show single quotes around the 'and' with double quotes around the parameters, so guess I should have paid more attention. Thanks again for your persistence!
Answers.UserDisplayName: Roi Agneta
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-01T22:07:12.893Z
Answers.LastActivityDate: 2019-01-02T23:25:12.777Z
Answers.LastEditDate: 2019-01-02T23:25:12.777Z
Answers.UserDisplayName: JollyR
Body: <p>I have a custom date field - "renewalDate" - which I want to use to limit an entry query. Here is the code:</p>
  
  <p>When I run that it throws this error:</p>
  
  <p>"Calling unknown method: craft\behaviors\ElementQueryBehavior::renewalDate()"</p>
  
  <pre><code>{% set dateStart = now|date('Y-m-d H:i')  %}
  {% set dateEnd = date('next month') | date('Y-m-d H:i')  %}
  
  {% set list = craft.users()
  .group('members') 
  .status(null)
  .orderBy('lastName asc')
  .renewalDate('and', '&gt;= #{dateStart}', '&lt; #{dateEnd}')
  
  %}
  </code></pre>
  
  <p>However, this works fine:</p>
  
  <pre><code>{% set list = craft.users()
  .group('members') 
  .status(null)
  .orderBy('lastName asc')
  .renewalDate('&gt;= #{dateStart}') 
  %}
  </code></pre>
  
  <p>So, the problem seems to be related to using "and". </p>
  
  <p>I have done this before using Craft 2, but it is not working with Craft 3. I am missing something here?</p>
  
  <p>Thanks!</p>
  
Tags: <datetime><limit><elementquery>
Title: Date Limit on Element Query
ThreadText: # Date Limit on Element Query
  
  (Asked by: username_0 on 2018-12-31)
  
  I have a custom date field - "renewalDate" - which I want to use to limit an entry query. Here is the code:
  
  When I run that it throws this error:
  
  "Calling unknown method: craft\behaviors\ElementQueryBehavior::renewalDate()"
  
  ```
  {% set dateStart = now|date('Y-m-d H:i')  %}
  {% set dateEnd = date('next month') | date('Y-m-d H:i')  %}
  
  {% set list = craft.users()
  .group('members') 
  .status(null)
  .orderBy('lastName asc')
  .renewalDate('and', '>= #{dateStart}', '< #{dateEnd}')
  
  %}
  
  ```
  
  However, this works fine:
  
  ```
  {% set list = craft.users()
  .group('members') 
  .status(null)
  .orderBy('lastName asc')
  .renewalDate('>= #{dateStart}') 
  %}
  
  ```
  
  So, the problem seems to be related to using "and".
  
  I have done this before using Craft 2, but it is not working with Craft 3. I am missing something here?
  
  Thanks!
  
  **Tags:** datetime, limit, elementquery
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-01-01. Score: 2 | Accepted answer
  
  Have you tried
  
  ```
  .renewalDate('and', ">= #{dateStart}", "< #{dateEnd}")
  
  ```
  
  The difference is the double quotes. I don't think that single quotes support interpolation.
  
  However, I'm not sure in that case why the version without the 'and' works.
  
  OK, have just tried it myself...
  I created a section called test and added a single date field called renewalDate and the code below works on a simple listing page.
  
  ```
  {% set dateStart = now|date('Y-m-d H:i')  %}
  {% set dateEnd = date('next month') | date('Y-m-d H:i')  %}
  
  {% set params = {
    section : 'test',
    orderBy : 'renewalDate asc',
    renewalDate : ['and', ">= #{dateStart}", "< #{dateEnd}"]
  } %}
  
  <h1>Entries</h1>
  {% for entry in craft.entries(params).all() %}
      <p>{{ entry.title }}</p>
  {% endfor %}
  
  ```
  
  > **Comments:**
  > **username_0**: Tried that but no luck - thanks, though!  
  > **username_1**: OK, have just tried it myself and have edited my answer with some actual working code. It's not exactly the same as yours but it's very close. Interestingly it only worked with double quotes. In my version the 'and' and two filters are in an array, so maybe that is what you need on your code.  
  > **username_0**: Thanks @username_1 - I had tried using an array at one point, but guess I did not use double quote. Also, I checked the docs and there are a few examples that clearly show single quotes around the 'and' with double quotes around the parameters, so guess I should have paid more attention. Thanks again for your persistence!  
  
  ---
  
  