From a69e175cf5ab6922a316034802f9f3c226161d7f Mon Sep 17 00:00:00 2001 From: isUnknown Date: Sat, 21 Sep 2024 09:33:17 +0200 Subject: [PATCH] fix future / past events --- site/plugins/helpers/index.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/site/plugins/helpers/index.php b/site/plugins/helpers/index.php index 0a055f4..06df972 100644 --- a/site/plugins/helpers/index.php +++ b/site/plugins/helpers/index.php @@ -11,6 +11,9 @@ function filterFutureEvents($events) { })->data; $futureDates = array_filter($sessionDates, function ($date) { + // strtotime() gives the timestamp for midnight + // time() gives the current timestamp so if the event occurs today it will be considered as past after midnight + // so we need to add a day, in seconds $oneDayInSecond = 24*60*60; $dateTimeStamp = strtotime($date) + $oneDayInSecond; @@ -37,6 +40,10 @@ function filterPastEvents($events) { })->data; $pastDates = array_filter($sessionDates, function ($date) { + // strtotime() gives the timestamp for midnight + // time() gives the current timestamp so if the event occurs today it will be considered as past after midnight + // so we need to add a day, in seconds + $oneDayInSecond = 24*60*60; $oneDayInSecond = 24*60*60; $dateTimeStamp = strtotime($date) - $oneDayInSecond; return $date < time();