diff --git a/src/NodaTimeSplitter.php b/src/NodaTimeSplitter.php index ae38835..94b2d4d 100644 --- a/src/NodaTimeSplitter.php +++ b/src/NodaTimeSplitter.php @@ -304,6 +304,11 @@ final class NodaTimeSplitter { $end = "-" . substr($datum, 4, 3); return [$start, $end, "00", "00", "-"]; } + if (preg_match("/^[0-9][0-9](\-|\/)[0-9][0-9] v\. Chr\.$/", $datum)) { + $start = "-00" . substr($datum, 0, 2); + $end = "-00" . substr($datum, 3, 2); + return [$start, $end, "00", "00", "-"]; + } if (self::stri_occurs($datum, self::STOP_STRINGS_GERMAN)) { return []; @@ -423,7 +428,7 @@ final class NodaTimeSplitter { $datum = self::clean_input($datum); - if (preg_match("/^[0-9][0-9][0-9][0-9](-|\/)[0-9][0-9][0-9][0-9]$/", $datum)) { + if (preg_match("/^[0-9][0-9][0-9][0-9](\-|\/)[0-9][0-9][0-9][0-9]$/", $datum)) { $start = substr($datum, 0, 4); $end = substr($datum, -4); return [$start, $end, "00", "00", "+"]; @@ -471,11 +476,16 @@ final class NodaTimeSplitter { $end = substr($datum, -4); return [$start, $end, "00", "00", "+"]; } - if (preg_match("/[0-9][0-9][0-9]\-[0-9][0-9][0-9]$/", $datum)) { // Hungarian Y-m + if (preg_match("/^[0-9][0-9][0-9]\-[0-9][0-9][0-9]$/", $datum)) { // Hungarian Y-m $start = substr($datum, 0, 3); $end = substr($datum, -3); if ($end > $start) return ["0" . $start, "0" . $end, "00", "00", "+"]; } + if (preg_match("/^[0-9][0-9]\-[0-9][0-9]$/", $datum)) { // Hungarian Y-m + $start = substr($datum, 0, 2); + $end = substr($datum, -2); + if ($end > $start) return ["00" . $start, "00" . $end, "00", "00", "+"]; + } if (preg_match("/^[0-9][0-9][0-9][0-9]$/", $datum)) {