Allow splitting 1945-48

This commit is contained in:
2025-01-15 10:35:35 +01:00
parent 546c17031a
commit 9c2eaa2929
2 changed files with 23 additions and 2 deletions

View File

@ -590,10 +590,18 @@ final class NodaTimeSplitter {
return NodaSplitTime::genExactDate($year, $month, $day);
}
// Intl': 2020-12
if (\preg_match("/^[0-9]{4}\-[0-9]{2}$/", $datum)) { // German Y-m
if (\preg_match("/^[0-9]{4}\-[0-9]{2}$/", $datum)) { // German Y-m or 1912-15
$year = \substr($datum, 0, 4);
$month = \substr($datum, 5, 2);
return new NodaSplitTime($year, $year, $month);
// Assume the end is a month
if (intval($month) < 12) {
return new NodaSplitTime($year, $year, $month);
}
else {
$end = \substr($year, 0, 2) . $month;
return new NodaSplitTime($year, $end);
}
}
// German MM.JJJJ