- Issue created by @emerham
- πΊπΈUnited States shelane
Thanks for reporting this. I was able to replicate it with another case as all of these methods were given an updated signature with typing. In my case of a date that is not a date range date, this fix worked.
Can you test this patch?
- πΊπΈUnited States emerham
Still getting the same error in the function formatRange.
I think there's an issue in the formatRange, intellephese is saying that $output on line 293 is "probably undefined". Checking the logic it looks like if I don't have the option of "Show time" checked that $output will never be set and thus is null and being returned as such
if (isset($options['display_time']) && $options['display_time']) { $date_output = $start_stamp->format($format_start_date); if (!empty($format_end_date)) { $date_output .= (isset($options['separator']) && $options['separator'] == 'endash' ? ' – ' : ' to ') . $end_stamp->format($format_end_date); } $time_output = $this->getTimeOutput($normalized_timestamps, $options, $fieldtype); if (!empty($time_output) && isset($options['time_before_date']) && $options['time_before_date']) { $output = $time_output . ', ' . $date_output; } elseif (!empty($time_output)) { $output = $date_output . ', ' . $time_output; } else { $output = $date_output; } } return $output;
- πΊπΈUnited States emerham
I moved the if (isset($options['display_time']) && $options['display_time']) down 4 lines and added a new else statement to ensure that $output will have a value.
did some testing both showing and not showing the time date time range that is both same day and different days at different times.
-
shelane β
committed 92133ec9 on 8.x-1.x authored by
emerham β
Issue #3387650 by emerham, shelane: TypeError in formatRange
-
shelane β
committed 92133ec9 on 8.x-1.x authored by
emerham β
- πΊπΈUnited States kmonahan
Was just in the process of making a patch with the same change. :) Can confirm that #5 fixes the issue for me.
- Status changed to Fixed
over 1 year ago 9:39pm 15 September 2023 Automatically closed - issue fixed for 2 weeks with no activity.