Answers.Body: <p>String interpolation in Twig only works with double-quoted strings.</p>
  <p>Change the <code>.startDate</code> line to <code>.startDate(['and', &quot;&gt;= #{start}&quot;, &quot;&lt; #{end}&quot;])</code> and it should work.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-14T15:02:33.630Z
Answers.LastActivityDate: 2021-01-14T15:02:33.630Z
Answers.UserDisplayName: Steve Rowling
Body: <p>I'm trying to filter entries on the front end by a date range but no matter what I do I end up with no results, despite there being results in the, temporarily hard coded, date range I am using.</p>
  <pre><code>
    {% set page = page ?? 1 %}
    {# set search parameter here #}
    {% set search = q ?? '' %}
    {# stage #}
    {% set stage = stage ?? '' %}
    {# date #}
    {% set start = now|date_modify('-16 week')|atom %}
    {% set end = now|date_modify('-1 week')|atom %}
  
  
    {% set entryQuery = craft.entries
      .section('projects')
      .limit(limit)
      .stage(stage)
      .startDate(['and', '&gt;= #{start}', '&lt; #{end}'])
      .search(search) %}
      
      {% for entry in entries %}
        {% include '_includes/project-listing-card' %}
      {% endfor %}
  
  </code></pre>
  <p>The code above sets some parameters based on the url and defaults. Without the <code>.startDate</code> line this outputs entries as expected. However once I add in the startDate (a date field) nothing gets output.</p>
  <p>How do I output entries that are in the date range?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-01-14T14:39:56.100Z
Comments.Text: I think you need to use double quotes for string interpolation, so `">= #{start}"` and `"< #{end}"`.
Comments.UserDisplayName: Steve Rowling
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-01-14T15:02:30.673Z
Comments.Text: @SteveRowling that fixed it, if you make this an answer, I'll mark it correct
Comments.UserDisplayName: CreateSean
Tags: <templating><datetime>
Title: Entries limited by date range
ThreadText: # Entries limited by date range
  
  (Asked by: username_0 on 2021-01-14)
  
  I'm trying to filter entries on the front end by a date range but no matter what I do I end up with no results, despite there being results in the, temporarily hard coded, date range I am using.
  
  ```
  
    {% set page = page ?? 1 %}
    {# set search parameter here #}
    {% set search = q ?? '' %}
    {# stage #}
    {% set stage = stage ?? '' %}
    {# date #}
    {% set start = now|date_modify('-16 week')|atom %}
    {% set end = now|date_modify('-1 week')|atom %}
  
    {% set entryQuery = craft.entries
      .section('projects')
      .limit(limit)
      .stage(stage)
      .startDate(['and', '>= #{start}', '< #{end}'])
      .search(search) %}
      
      {% for entry in entries %}
        {% include '_includes/project-listing-card' %}
      {% endfor %}
  
  ```
  
  The code above sets some parameters based on the url and defaults. Without the `.startDate` line this outputs entries as expected. However once I add in the startDate (a date field) nothing gets output.
  
  How do I output entries that are in the date range?
  
  **Tags:** templating, datetime
  
  > **Comments:**
  > **username_1**: I think you need to use double quotes for string interpolation, so `">= #{start}"` and `"< #{end}"`.  
  > **username_0**: @username_1 that fixed it, if you make this an answer, I'll mark it correct  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-01-14. Score: 3 | Accepted answer
  
  String interpolation in Twig only works with double-quoted strings.
  
  Change the `.startDate` line to `.startDate(['and', ">= #{start}", "< #{end}"])` and it should work.
  
  
  ---
  
  