diff --git a/CRM/Volunteer/Page/Roster.php b/CRM/Volunteer/Page/Roster.php index 45846bf4..3838bc7a 100644 --- a/CRM/Volunteer/Page/Roster.php +++ b/CRM/Volunteer/Page/Roster.php @@ -97,13 +97,15 @@ private function isAssignmentInThePast(array $assignment){ return TRUE; } - // In case there is no end time and no duration, we use the start date as - // our default end date. - $endTime = new DateTime($assignment['start_time']); + $startTime = new DateTime($assignment['start_time']); if (!empty($assignment['end_time'])) { $endTime = new DateTime($assignment['end_time']); } elseif (!empty($assignment['duration'])) { - $endTime = date_add($assignment['start_time'], new DateInterval('PT' . $assignment['duration'] . 'M')); + $endTime = date_add($startTime, new DateInterval('PT' . $assignment['duration'] . 'M')); + } else { + // In case there is no end time and no duration, we use the start date as + // our default end date. + $endTime = $startTime; } return $this->todaysDate > $endTime;