diff --git a/src/NodaTimeSplitter.php b/src/NodaTimeSplitter.php index b31304f..b2d6d42 100644 --- a/src/NodaTimeSplitter.php +++ b/src/NodaTimeSplitter.php @@ -1086,6 +1086,12 @@ final class NodaTimeSplitter { if (!$moda) $moda = NodaTimeSplitter::is_century($datum); if (!$moda) $moda = NodaTimeSplitter::is_decade($datum); + if (!empty($moda)) { + if ((int)$moda[2] > 12 || (int)$moda[3] > 31) { + return []; + } + } + return $moda; } diff --git a/tests/NodaTimeSplitterTest.php b/tests/NodaTimeSplitterTest.php index 11de382..826658c 100644 --- a/tests/NodaTimeSplitterTest.php +++ b/tests/NodaTimeSplitterTest.php @@ -593,6 +593,16 @@ final class NodaTimeSplitterTest extends TestCase { $output = NodaTimeSplitter::attempt_splitting("Januar-Februar"); self::assertEquals($output, []); + $output = NodaTimeSplitter::attempt_splitting("13.13.2022"); + self::assertEquals($output, []); + $output = NodaTimeSplitter::attempt_splitting("2022-13-13"); + self::assertEquals($output, []); + + $output = NodaTimeSplitter::attempt_splitting("40.10.2022"); + self::assertEquals($output, []); + $output = NodaTimeSplitter::attempt_splitting("2022-10-40"); + self::assertEquals($output, []); + # $output = NodaTimeSplitter::attempt_splitting("Nach 1944-1964"); # self::assertEquals($output, []);