Add exception catching in splitting times / dates
This commit is contained in:
parent
54764e741a
commit
c02165df7b
@ -1004,8 +1004,13 @@ final class NodaTimeSplitter {
|
||||
|
||||
if ($start[4] === '-') return [];
|
||||
|
||||
$startDate = new DateTime($start[4] . $start[0] . '-' . $start[2] . '-' . $start[3]);
|
||||
$endDate = new DateTime($end[4] . $end[1] . '-' . $end[2] . '-' . $end[3]);
|
||||
try {
|
||||
$startDate = new DateTime($start[4] . $start[0] . '-' . $start[2] . '-' . $start[3]);
|
||||
$endDate = new DateTime($end[4] . $end[1] . '-' . $end[2] . '-' . $end[3]);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$interval = $startDate->diff($endDate);
|
||||
$days_diff = (int)$interval->format('%a');
|
||||
|
Loading…
Reference in New Issue
Block a user