# Handling Events with multiple dates

**URL:** <https://forum.getkirby.com/t/handling-events-with-multiple-dates/35600>\
**Category:** Questions\
**Tags:** v5\
**Created:** [September 9, 2026, 7:25am UTC](https://forum.getkirby.com/t/handling-events-with-multiple-dates/35600 "2026-09-09T07:25:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![matzebuchholz](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@matzebuchholz](https://forum.getkirby.com/u/matzebuchholz)\
**Post date:** [September 9, 2026, 7:25am UTC](https://forum.getkirby.com/t/handling-events-with-multiple-dates/35600/1 "2026-09-09T07:25:00Z")

</div>

I try to build an events-page and the events should have the possibility to enter multiple dates.  
For the event-child-page i use the new entries-field with a date field and tried to get it to work with this two topics:

> [@Add the same page to a collection multiple times](https://forum.getkirby.com/t/add-the-same-page-to-a-collection-multiple-times/32146):
>
> Hi friends slight_smile is it true, that i cant add the same page to a collection multiple times? What i want to do: i am creating an event calendar and some events have multiple dates. To avoid having to add the event multiple times in the panel, i added a field where you can add all event dates. The output of my calendar first shows the month (August 2024) and then all events in this period. So when an event series takes place in august and september, i want the event to be shown in both…

> [@How to handle multi-date events as separate pages](https://forum.getkirby.com/t/how-to-handle-multi-date-events-as-separate-pages/32635):
>
> I have events master pages that have multiple dates that are maintained via structured fields. Subpages for the events seemed too cumbersome to me. However, it is now the case that each event should actually be its own page. The call should not be a problem with a custom route from slug and date. However, I am having difficulties with the template overviews. At the moment I’m using a loop through the dates to create duplicates of the page and add the date as an object variable. Is there a bett…

… but I can’t get it to work. ☹ Can you help me?

here is the code of the events-page:

```auto
$recurringEvents = $page
			->children()
			->listed()
			->filterBy('intendedTemplate', 'event-recurring');

		$consolidatedEvents = new Pages();
			foreach($recurringEvents as $recurringEvent) {
				$dates = $recurringEvent->dates()->toEntries();
				foreach($dates as $date) {
					$eventDate = $date->toDate();
					if($eventDate > strtotime('-1 day')) {
						$recurringEvent->setEventDate($eventDate);
						$consolidatedEvents->add($recurringEvent);
					}
				}
			}

```

and here is the page-model:

```auto
<?php
  class EventPage extends Page {

    protected $eventdate;

    public function setEventDate($date) {
      $this->eventdate = $date;
    }
    
  }
?>

```

There is no sorting at the moment, I wanted to see if I can get a collection with the same event multiple times at first, but I get only one.

---

<div class="post-metadata">

**Author:** ![ahmetbora](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ahmetbora/32/11671_2.png) [@ahmetbora](https://forum.getkirby.com/u/ahmetbora)\
**Post date:** [September 11, 2026, 9:10am UTC](https://forum.getkirby.com/t/handling-events-with-multiple-dates/35600/2 "2026-09-11T09:10:39Z")

</div>

`$consolidatedEvents->add($recurringEvent)` stores the page under its ID as the collection key, so adding the same event again just overwrites the previous entry. Use `append()` with a unique key instead, e.g.

```php
$consolidatedEvents->append($recurringEvent->id() . '-' . $eventDate, $recurringEvent);

```

---

<div class="post-metadata">

**Author:** ![matzebuchholz](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@matzebuchholz](https://forum.getkirby.com/u/matzebuchholz)\
**Post date:** [September 14, 2026, 10:34am UTC](https://forum.getkirby.com/t/handling-events-with-multiple-dates/35600/3 "2026-09-14T10:34:48Z")

</div>

Thanks a lot!

now I get a collection with the same page multiple times. 🙂

But there is still one Problem: The pageModel function seems not to work, the single date is not set for each event.

is the pageModel-Code correct for setting a “eventDate” property?

```auto
<?php
  class EventsPage extends Page {

    protected $eventDate;

    public function setEventDate($date) {
      $this->eventDate = $date;
    }
    
  }
?>

```

---

<div class="post-metadata">

**Author:** ![ahmetbora](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ahmetbora/32/11671_2.png) [@ahmetbora](https://forum.getkirby.com/u/ahmetbora)\
**Post date:** [September 14, 2026, 10:56am UTC](https://forum.getkirby.com/t/handling-events-with-multiple-dates/35600/4 "2026-09-14T10:56:47Z")

</div>

Hmm, I think you keep adding the same page object in the loop, so setEventDate overwrites it every time and all of them end up with the last date. Try cloning the page for each date:

```php
$occurrence = $recurringEvent->clone();
$occurrence->setEventDate($eventDate);
$consolidatedEvents->append($recurringEvent->id() . '-' . $eventDate, $occurrence);

```

Also, if the template is event-recurring, shouldn’t the class be EventRecurringPage instead of EventsPage? Or am I missing something. And you can add a getter to read the date:

```php
class EventRecurringPage extends Page
{
    protected $eventDate;

    public function eventDate()
    {
        return $this->eventDate;
    }

    public function setEventDate($date)
    {
        $this->eventDate = $date;
    }
}

```

Then `$event->eventDate()` works in your snippet, and `sortBy('eventDate')` too.

---

<div class="post-metadata">

**Author:** ![matzebuchholz](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@matzebuchholz](https://forum.getkirby.com/u/matzebuchholz)\
**Post date:** [September 14, 2026, 11:38am UTC](https://forum.getkirby.com/t/handling-events-with-multiple-dates/35600/5 "2026-09-14T11:38:11Z")

</div>

Big thanks!
