diff --git a/src/Plugin/Block/UwCblWaterlooEvents.php b/src/Plugin/Block/UwCblWaterlooEvents.php index 9b41c27d3ebef987797198deeab31eef98b60278..5fbac1357e48415c459d9ad1e297292be784c2eb 100644 --- a/src/Plugin/Block/UwCblWaterlooEvents.php +++ b/src/Plugin/Block/UwCblWaterlooEvents.php @@ -136,34 +136,14 @@ class UwCblWaterlooEvents extends BlockBase implements ContainerFactoryPluginInt 'day' => date('j', $event['next_date']['start_timestamp']), ]; - // If the duration is 24 hours we have a possible all - // day event, so we need to check if it is all day. - if ($event['next_date']['duration'] == 1439) { - - // Get the start and end dates. - $start = date('g:i a', strtotime($event['next_date']['start_timestamp'])); - $end = date('g:i a', strtotime($event['next_date']['end_timestamp'])); - - // If the start and end dates are 12 am and pm, - // we have an all day event, if not it is just - // a 24 hour event, so use that time. - if ($start == '12:00 am' && $end == '11:59 pm') { - - // Set the info about the listed date. - $event_date['time'] = 'All day'; - break; - } - else { - - // Set the info about the listed date. - $event_date['time'] = date('g a', $event['next_date']['start_timestamp']); - break; - } + // If the all day flag is set and true, + // identify the event as all day. + if (!empty($event['next_date']['all_day'])) { + $event_date['time'] = 'All day'; } else { - // Set the info about the listed date. - $event_date['time'] = date('g:i a', $event['next_date']['start_timestamp']); + $event_date['time'] = $event['next_date']['start_time']; } // If there is no event date, it means that all the event