Fix erroneous splitting of "YYYY MMD" in Hungarian
This commit is contained in:
parent
27e259072c
commit
2ab0e75111
|
@ -531,6 +531,10 @@ final class NodaTimeSplitter {
|
||||||
if (empty($monat) and self::is_numeric((string)\substr($datum, 5, 2))) $monat = \substr($datum, 5, 2);
|
if (empty($monat) and self::is_numeric((string)\substr($datum, 5, 2))) $monat = \substr($datum, 5, 2);
|
||||||
else if (empty($monat) and self::is_numeric((string)\substr($datum, 6, 2))) $monat = \substr($datum, 6, 2);
|
else if (empty($monat) and self::is_numeric((string)\substr($datum, 6, 2))) $monat = \substr($datum, 6, 2);
|
||||||
|
|
||||||
|
// Last four characters must contain at least one space or one dot
|
||||||
|
$lastChars = substr($datum, -4);
|
||||||
|
if (str_contains($lastChars, '.') === false && str_contains($lastChars, ' ') === false) return [];
|
||||||
|
|
||||||
$day = self::validateDateSubstr($datum, -2);
|
$day = self::validateDateSubstr($datum, -2);
|
||||||
if (empty($day)) $day = self::validateDateSubstr($datum, -3, 2);
|
if (empty($day)) $day = self::validateDateSubstr($datum, -3, 2);
|
||||||
if (empty($day)) $day = self::validateDateSubstr($datum, -4, 2);
|
if (empty($day)) $day = self::validateDateSubstr($datum, -4, 2);
|
||||||
|
|
|
@ -878,6 +878,9 @@ final class NodaTimeSplitterTest extends TestCase {
|
||||||
$output = NodaTimeSplitter::attempt_splitting("6552cf08b0196 test tag");
|
$output = NodaTimeSplitter::attempt_splitting("6552cf08b0196 test tag");
|
||||||
self::assertEmpty($output);
|
self::assertEmpty($output);
|
||||||
|
|
||||||
|
$output = NodaTimeSplitter::attempt_splitting("1978. július7");
|
||||||
|
self::assertEmpty($output);
|
||||||
|
|
||||||
$output = NodaTimeSplitter::attempt_splitting("Anfang September 1903");
|
$output = NodaTimeSplitter::attempt_splitting("Anfang September 1903");
|
||||||
self::assertEmpty($output);
|
self::assertEmpty($output);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user