Trying to figure out how to filter dates from a structure-field and only show dates that are in the future.
Filterering from the pages works like a charm, but it reveals all the input from the structurefields.
Went trough a couple of other topics. Cant really make heads or tails.
<?php
$items = page('archief')->children()->filter(function($child) {
$structure = $child->playtime()->toStructure();
return $structure->filter(function($item) {
$today = mktime(0, 0, 0, date("m") , date("d"), date("Y"));
return $item->eventdate()->toDate() > $today;
})->count();
});
?>
<?php foreach ($items as $event): ?>
<a href="<?= $event->url() ?>">
<li class="event-container">
<ul class="event-flex">
<?php foreach ($event->playtime()->toStructure() as $date): ?>
<ul class="playtime">
<li>
<h1><?= $date->eventdate()->toDate('%a') ?></h1>
<h1><?= $date->eventdate()->toDate('%d') ?></h1>
<h1><?= $date->eventdate()->toDate('%B') ?></h1>
<h1><?= $date->time() ?></h1>
<h4><?= $date->eventtype() ?></h4>
</li>
<li><span class="ticket-button">TICKET</span></li>
</ul>
<?php endforeach ?>
</figcaption>
<?php endforeach ?>