diff --git a/src/NodaTimeSplitter.php b/src/NodaTimeSplitter.php index a3febba..6230bdf 100644 --- a/src/NodaTimeSplitter.php +++ b/src/NodaTimeSplitter.php @@ -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');