I have a structure with a field like this:
sections:
fields:
type: fields
fields:
shows:
type: structure
fields:
date:
label: Datum
type: date
display: DD.MM.YYYY
default: today
and i’m only want to display fields whose date is today or in the future (it’s for concerts) but i somehow can’t make it work…
<?php
$items = $data->shows()->toStructure()->sortBy('date','desc');
$currentDate = date('d-m-Y');
foreach ($items as $item):
$itemDate = $item->date()->toDate('d-m-Y');
if ($currentDate < $itemDate):
?>
<div class="flex-live">
<p class="live-text-primary">
<?= $itemDate ?>
</p>
<div>
...
If I change the line to
if ($currentDate == $itemDate):
it works and only shows the current date but otherwise it’s also showing dates from the past…