Prevent noda time splitter from suggesting times with months beyond 12,
days beyond 31
This commit is contained in:
parent
3c67d425fb
commit
1ed2959b62
@ -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;
|
||||
|
||||
}
|
||||
|
@ -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, []);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user