diff --git a/Civi/DataProcessor/FieldOutputHandler/DateRangeFieldOutputHandler.php b/Civi/DataProcessor/FieldOutputHandler/DateRangeFieldOutputHandler.php index 90a1a56fc2f1ac808a9aa8e7250b600854dd4533..e5a8501dc7ca33b23c0380db53b0dc3a4151ecf8 100644 --- a/Civi/DataProcessor/FieldOutputHandler/DateRangeFieldOutputHandler.php +++ b/Civi/DataProcessor/FieldOutputHandler/DateRangeFieldOutputHandler.php @@ -152,8 +152,6 @@ class DateRangeFieldOutputHandler extends DateFieldOutputHandler { * @return \Civi\DataProcessor\FieldOutputHandler\FieldOutput */ public function formatField($rawRecord, $formattedRecord) { - // todo: use $this->omitEndDate - $output = new FieldOutput($rawRecord[$this->inputFieldSpec->alias]); $rawValue = $rawRecord[$this->inputFieldSpec->alias]; @@ -170,17 +168,15 @@ class DateRangeFieldOutputHandler extends DateFieldOutputHandler { } $isSameDay = FALSE; - if ($this->omitEndDate) { - if (isset($output->rawValue) && isset($rawValue2)) { - $startDate = new DateTime($output->rawValue); - $startDay = $startDate->format('Y-m-d'); + if ($this->omitEndDate && isset($output->rawValue)) { + $startDate = new DateTime($output->rawValue); + $startDay = $startDate->format('Y-m-d'); - $endDate = new DateTime($rawValue2); - $endDay = $endDate->format('Y-m-d'); + $endDate = new DateTime($rawValue2); + $endDay = $endDate->format('Y-m-d'); - if ($startDay === $endDay) { - $isSameDay = TRUE; - } + if ($startDay === $endDay) { + $isSameDay = TRUE; } } if ($isSameDay) { @@ -193,7 +189,7 @@ class DateRangeFieldOutputHandler extends DateFieldOutputHandler { $output->formattedValue .= $this->separator; } - $onlyTime = preg_replace('#.+(\d{2}\:\d{2})([ A-Za-z]*)$#', '$1$2', $output2->formattedValue); + $onlyTime = preg_replace('#.+(\d{2}:\d{2})([ A-Za-z]*)$#', '$1$2', $output2->formattedValue); $output->formattedValue .= $onlyTime; } else {