From e2b71bd07e8c2e72bf704df156f048ed7699d987 Mon Sep 17 00:00:00 2001 From: Eric Bremner <ebremner@uwaterloo.ca> Date: Fri, 21 Apr 2023 15:27:15 -0400 Subject: [PATCH] ISTWCMS-6155: fixing displaying end date on events when dates span multiple days but are less than 24 hours --- src/Service/UwNodeFieldValue.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Service/UwNodeFieldValue.php b/src/Service/UwNodeFieldValue.php index 06280f5f..f06f433c 100644 --- a/src/Service/UwNodeFieldValue.php +++ b/src/Service/UwNodeFieldValue.php @@ -898,23 +898,29 @@ class UwNodeFieldValue { $return_date = []; if ($type == 'event') { + + // Check for same day. + if (date( 'Ymd', $date['value']) == date( 'Ymd', $date['end_value'])) { + $return_date['same_day'] = TRUE; + } + else { + $return_date['same_day'] = FALSE; + } + // If this is the same day, get the date and the start and end times. if ($date['duration'] < '1439') { $return_date['all_day'] = FALSE; $return_date['date_range'] = TRUE; - $return_date['same_day'] = TRUE; } // This is not the day, get the start and end date with time. elseif ($date['duration'] > '1439') { $return_date['all_day'] = FALSE; $return_date['date_range'] = TRUE; - $return_date['same_day'] = FALSE; } // The all date case, duration is always 1439. else { $return_date['all_day'] = TRUE; $return_date['date_range'] = TRUE; - $return_date['same_day'] = FALSE; } $return_date['start_date'] = $date['value']; -- GitLab