fix future / past events
This commit is contained in:
parent
940daffb2e
commit
a69e175cf5
1 changed files with 7 additions and 0 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue