fix future / past events

This commit is contained in:
isUnknown 2024-09-21 09:33:17 +02:00
parent 940daffb2e
commit a69e175cf5

View file

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