Add tests for German dates, enable splitting of 5 digit timespans
This commit is contained in:
		| @@ -431,7 +431,11 @@ final class NodaTimeAutotranslater { | ||||
|         foreach (self::LANGS_TO_CE_FORMAT as $tLang => $ceFormat) { | ||||
|  | ||||
|             if ($suffixMode === 2) { | ||||
|                 $ceIndicatorsToRemove = explode("%s", self::LANGS_TO_CE_FORMAT[$tLang]); | ||||
|                 $year = self::getTranslations($timeInfoToCopy)[$tLang]; | ||||
|                 foreach ($ceIndicatorsToRemove as $ceIndicatorToRemove) { | ||||
|                     $year = str_replace($ceIndicatorToRemove, "", $year); | ||||
|                 } | ||||
|             } | ||||
|             else { | ||||
|                 if ($start === $end) { | ||||
|   | ||||
| @@ -330,7 +330,7 @@ final class NodaTimeSplitter { | ||||
|                     $end = $start; | ||||
|                     $start = $startToSet; | ||||
|                 } | ||||
|                 return [$start, $end, $output[2], $output[3], '-']; | ||||
|                 return [$start, $end, $output[2], $output[3], '-', ""]; | ||||
|             } | ||||
|         } | ||||
|  | ||||
| @@ -469,6 +469,13 @@ final class NodaTimeSplitter { | ||||
|  | ||||
|         $datum = self::clean_input($datum); | ||||
|  | ||||
|         // 10000-20000 | ||||
|         if (!empty(preg_match("/^[0-9][0-9][0-9][0-9][0-9](\-|\/)[0-9][0-9][0-9][0-9][0-9]$/", $datum))) { | ||||
|             $start = substr($datum, 0, 5); | ||||
|             $end = substr($datum, 6, 5); | ||||
|             return [$start, $end, "00", "00", "+", ""]; | ||||
|         } | ||||
|  | ||||
|         // 0000-0000 | ||||
|         if (!empty(preg_match("/^[0-9][0-9][0-9][0-9](\-|\/)[0-9][0-9][0-9][0-9]$/", $datum)) | ||||
|             || !empty(preg_match("/^[0-9][0-9][0-9][0-9](\-|\/)[0-9][0-9][0-9][0-9]\.$/", $datum)) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user