Commit 4baa3ccb authored by Thomas Löffler's avatar Thomas Löffler
Browse files

Merge branch 'task/simplify-event-on-same-day-logic' into 'develop'

[TASK] Move event onSameDay logic into own getter, to remove logic from fluid template

See merge request !467
parents 584ef7c1 0dc97616
Pipeline #25476 passed with stages
in 5 minutes and 12 seconds
......@@ -92,4 +92,13 @@ class Event extends \DERHANSEN\SfEventMgt\Domain\Model\Event
return $highlightedParticipantObjects;
}
public function isOnSameDay(): bool
{
$datetimeFormat = 'Ymd';
$startDate = $this->getStartDate();
$endDate = $this->getEndDate();
return $startDate->format($datetimeFormat) === $endDate->format($datetimeFormat);
}
}
......@@ -4,9 +4,7 @@
<f:if condition="{event.startDate} && {event.enddate}">
<f:then>
<f:comment><!--Check if startdate and enddate are on the same day--></f:comment>
<f:if condition="
{f:format.date(date:event.startdate, format:'Y-m-d')} == {f:format.date(date:event.enddate, format:'Y-m-d')}
">
<f:if condition="{event.onSameDay}">
<f:then>
<time>
<f:format.date date="{event.startdate}" format="{visibleDatetimeFormat}"/>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment