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();