Answers.Body: <p>You need to include an extra parameter in your initial query to only fetch event entries for events in the future and remove the conditional test from the <code>for</code> loop.</p>
  
  <p>Currently you are fetching all event entries and paginating those, but only displaying event entries where the <code>eventDate</code> is in the future.</p>
  
  <p>Try this instead:</p>
  
  <pre><code>{% paginate craft.entries.section('eventsEntry').limit(3).eventDate('&gt;=' ~ (now | date('Y-m-d H:i'))).orderBy('eventDate') as pageInfo, upcomingEvents %}
  
  {% for event in upcomingEvents %}     
  ...
  {% endfor %} 
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-17T13:37:04.197Z
Answers.LastActivityDate: 2019-05-17T13:37:04.197Z
Answers.UserDisplayName: Steve Rowling
Body: <p>Is there a way to paginate events entries without setting an expiry date for each entry? So I currently have:</p>
  
  <pre><code>{% paginate craft.entries.section('eventsEntry').limit(3).orderBy('eventDate') as pageInfo, upcomingEvents %}
  
  {% for event in upcomingEvents if event.eventDate &gt;= now %}     
  ...
  {% endfor %} 
  </code></pre>
  
  <p>But this will include past events in the loop but not show them when output. Which results in empty 'slots' on the first page.</p>
  
Tags: <pagination>
Title: Paginate events without setting expiry date
ThreadText: # Paginate events without setting expiry date
  
  (Asked by: username_0 on 2019-05-17)
  
  Is there a way to paginate events entries without setting an expiry date for each entry? So I currently have:
  
  ```
  {% paginate craft.entries.section('eventsEntry').limit(3).orderBy('eventDate') as pageInfo, upcomingEvents %}
  
  {% for event in upcomingEvents if event.eventDate >= now %}     
  ...
  {% endfor %} 
  
  ```
  
  But this will include past events in the loop but not show them when output. Which results in empty 'slots' on the first page.
  
  **Tags:** pagination
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-05-17. Score: 2 | Accepted answer
  
  You need to include an extra parameter in your initial query to only fetch event entries for events in the future and remove the conditional test from the `for` loop.
  
  Currently you are fetching all event entries and paginating those, but only displaying event entries where the `eventDate` is in the future.
  
  Try this instead:
  
  ```
  {% paginate craft.entries.section('eventsEntry').limit(3).eventDate('>=' ~ (now | date('Y-m-d H:i'))).orderBy('eventDate') as pageInfo, upcomingEvents %}
  
  {% for event in upcomingEvents %}     
  ...
  {% endfor %} 
  
  ```
  
  
  ---
  
  