Answers.Body: <p>The solution is to wrap the event output in a conditional that compares the event startdate to now. I've updated the question to reflect this.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-11T14:32:31.803Z
Answers.LastActivityDate: 2018-04-11T14:32:31.803Z
Answers.UserDisplayName: Vaughn D. Taylor
Body: <p>I'm trying to suppress display of expired events (events that occurred in the past) on the Solspace month calendar. I'm using the out-of-the-box templates included with Solspace Calendar for Craft. Initially, I thought that there would be a start and end range for the calendar.month function:</p>
  
  <pre><code>{% set month = craft.calendar.month({
      date: targetDate,
      calendar: calendarHandle,
  }) %}
  </code></pre>
  
  <p>But looking at the documentation, there are no parameters to pass. (<a href="https://solspace.com/craft/calendar/docs/calendar.month/" rel="nofollow noreferrer">https://solspace.com/craft/calendar/docs/calendar.month/</a>)</p>
  
  <p>So, I looked at what is happening, and it seems that the start and end should be set on the event object (<a href="https://solspace.com/craft/calendar/docs/event/" rel="nofollow noreferrer">https://solspace.com/craft/calendar/docs/event/</a>)</p>
  
  <p>In the month template, the event object is called here:</p>
  
  <pre><code>{% for event in day.events %}
      {% include "cal/layouts/_event.html" %}
  {% endfor %}
  </code></pre>
  
  <p>And this is what is returned:</p>
  
  <pre><code>{% set classes = "" %}
  {% set classes = classes ~ (event.allDay ? " all_day") %}
  
  {% if event.multiDay %}
      {% set classes = classes ~ " multi_day" %}
      {% set classes = classes ~ (day.containsDate(event.startDate) ? " first_day") %}
      {% set classes = classes ~ (day.containsDate(event.endDate) ? " last_day") %}
  {% endif %}
  
  {% set style = "" %}
      {% if event.multiDay or event.allDay %}
          {% set style %}
      style="background-color: {{ event.calendar.lighterColor }} !important;
          border-color: {{ event.calendar.color }} !important;"
      {% endset %}
  {% endif %}
  
  {% if event.startDate.format('U') &gt; now|date('U') %}
  
  &lt;div class="event tips{{ classes }}"{{ style }} data-toggle="popover"&gt;
          {% if event.multiDay %}
              &lt;a href="{{ siteUrl }}cal/event/{{ event.id }}/{{ event.repeating ? event.startDate.format('Y/m/d') }}"
      style="color: {{ event.calendar.contrastColor }} !important;"&gt;
                  {% autoescape false %}
                      {{ day.containsDate(event.startDate) or day.containsDate(event.endDate) ? event.title : "&amp;nbsp;"|raw }}
                  {% endautoescape %}
              &lt;/a&gt;
          {% else %}
              {% if not event.allDay %}
                  &lt;span class="calendar-color" style="background-color: {{ event.calendar.color }};"&gt;&lt;/span&gt;
              {% endif %}
                  &lt;a href="{{ siteUrl }}cal/event/{{ event.id }}/{{ event.repeating ? event.startDate.format('Y/m/d') }}"
                  {% if event.allDay %}style="color: {{ event.calendar.contrastColor }};"{% endif %}&gt;
                      {{ event.title }}
                  &lt;/a&gt;
          {% endif %}
  
      {% include "cal/layouts/_event_popover.html" %}
  &lt;/div&gt;
  
  {% endif %}
  </code></pre>
  
  <p>I assume this is where I would set a date range, but I'm not really clear where I would set it?</p>
  
  <p>UPDATE: I managed to get this working by wrapping the event output in a conditional:</p>
  
  <pre><code>{% if event.startDate.format('U') &gt; now|date('U') %}
  </code></pre>
  
  <p>I added this to the code above.</p>
  
Tags: <plugin-solspacecalendar>
Title: How to suppress display of expired entries in Solspace month calendar?
ThreadText: # How to suppress display of expired entries in Solspace month calendar?
  
  (Asked by: username_0 on 2018-04-11)
  
  I'm trying to suppress display of expired events (events that occurred in the past) on the Solspace month calendar. I'm using the out-of-the-box templates included with Solspace Calendar for Craft. Initially, I thought that there would be a start and end range for the calendar.month function:
  
  ```
  {% set month = craft.calendar.month({
      date: targetDate,
      calendar: calendarHandle,
  }) %}
  
  ```
  
  But looking at the documentation, there are no parameters to pass. (<https://solspace.com/craft/calendar/docs/calendar.month/>)
  
  So, I looked at what is happening, and it seems that the start and end should be set on the event object (<https://solspace.com/craft/calendar/docs/event/>)
  
  In the month template, the event object is called here:
  
  ```
  {% for event in day.events %}
      {% include "cal/layouts/_event.html" %}
  {% endfor %}
  
  ```
  
  And this is what is returned:
  
  ```
  {% set classes = "" %}
  {% set classes = classes ~ (event.allDay ? " all_day") %}
  
  {% if event.multiDay %}
      {% set classes = classes ~ " multi_day" %}
      {% set classes = classes ~ (day.containsDate(event.startDate) ? " first_day") %}
      {% set classes = classes ~ (day.containsDate(event.endDate) ? " last_day") %}
  {% endif %}
  
  {% set style = "" %}
      {% if event.multiDay or event.allDay %}
          {% set style %}
      style="background-color: {{ event.calendar.lighterColor }} !important;
          border-color: {{ event.calendar.color }} !important;"
      {% endset %}
  {% endif %}
  
  {% if event.startDate.format('U') > now|date('U') %}
  
  <div class="event tips{{ classes }}"{{ style }} data-toggle="popover">
          {% if event.multiDay %}
              <a href="{{ siteUrl }}cal/event/{{ event.id }}/{{ event.repeating ? event.startDate.format('Y/m/d') }}"
      style="color: {{ event.calendar.contrastColor }} !important;">
                  {% autoescape false %}
                      {{ day.containsDate(event.startDate) or day.containsDate(event.endDate) ? event.title : "&nbsp;"|raw }}
                  {% endautoescape %}
              </a>
          {% else %}
              {% if not event.allDay %}
                  <span class="calendar-color" style="background-color: {{ event.calendar.color }};"></span>
              {% endif %}
                  <a href="{{ siteUrl }}cal/event/{{ event.id }}/{{ event.repeating ? event.startDate.format('Y/m/d') }}"
                  {% if event.allDay %}style="color: {{ event.calendar.contrastColor }};"{% endif %}>
                      {{ event.title }}
                  </a>
          {% endif %}
  
      {% include "cal/layouts/_event_popover.html" %}
  </div>
  
  {% endif %}
  
  ```
  
  I assume this is where I would set a date range, but I'm not really clear where I would set it?
  
  UPDATE: I managed to get this working by wrapping the event output in a conditional:
  
  ```
  {% if event.startDate.format('U') > now|date('U') %}
  
  ```
  
  I added this to the code above.
  
  **Tags:** plugin-solspacecalendar
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-04-11. Score: 2 | Accepted answer
  
  The solution is to wrap the event output in a conditional that compares the event startdate to now. I've updated the question to reflect this.
  
  
  ---
  
  