Add capability to parse dates like "2300-800 v. Chr." (German) and "Kr.

e. 1200" (Hungarian)
This commit is contained in:
Joshua Ramon Enslin 2020-09-20 17:40:45 +02:00 committed by Stefan Rohde-Enslin
parent 8da158aa77
commit f268ab412c

View File

@ -294,7 +294,11 @@ final class NodaTimeSplitter {
$end = "-" . substr($datum, 5, 4);
return [$start, $end, "00", "00", "-"];
}
if (preg_match("/^[0-9][0-9][0-9][0-9](\-|\/)[0-9][0-9][0-9] v\. Chr\.$/", $datum)) {
$start = "-" . substr($datum, 0, 4);
$end = "-" . substr($datum, 5, 3);
return [$start, $end, "00", "00", "-"];
}
if (preg_match("/^[0-9][0-9][0-9](\-|\/)[0-9][0-9][0-9] v\. Chr\.$/", $datum)) {
$start = "-" . substr($datum, 0, 3);
$end = "-" . substr($datum, 4, 3);
@ -343,6 +347,11 @@ final class NodaTimeSplitter {
$datum = self::clean_input($datum);
if (preg_match("/^Kr\.\ e\.\ [0-9][0-9][0-9][0-9]$/", $datum)) {
$start = "-" . substr($datum, 7, 4);
return [$start, $start, "00", "00", "-"];
}
if (self::stri_occurs($datum, self::STOP_STRINGS_HUNGARIAN)) {
return [];
}