Allow splitting international dates (2020-12-20)
This commit is contained in:
parent
830b37f547
commit
48f3bd2c3f
|
@ -523,6 +523,15 @@ final class NodaTimeSplitter {
|
||||||
$day = "0" . substr($datum, 0, 1);
|
$day = "0" . substr($datum, 0, 1);
|
||||||
return [$start, $start, $month, $day, "+", ""];
|
return [$start, $start, $month, $day, "+", ""];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Intl': 2020-12-20
|
||||||
|
if (preg_match("/^[0-9][0-9][0-9][0-9]\-[0-9][0-9]\-[0-9][0-9]$/", $datum)) { // German Y-m
|
||||||
|
$start = substr($datum, 0, 4);
|
||||||
|
$month = substr($datum, 5, 2);
|
||||||
|
$day = substr($datum, 8, 2);
|
||||||
|
return [$start, $start, $month, $day, "+", ""];
|
||||||
|
}
|
||||||
|
// German MM.JJJJ
|
||||||
if (preg_match("/^[0-9][0-9]\.[0-9][0-9][0-9][0-9]$/", $datum)) { // German Y-m
|
if (preg_match("/^[0-9][0-9]\.[0-9][0-9][0-9][0-9]$/", $datum)) { // German Y-m
|
||||||
$start = substr($datum, 3, 4);
|
$start = substr($datum, 3, 4);
|
||||||
$month = substr($datum, 0, 2);
|
$month = substr($datum, 0, 2);
|
||||||
|
@ -543,6 +552,8 @@ final class NodaTimeSplitter {
|
||||||
$endDigits = substr($datum, 5, 2);
|
$endDigits = substr($datum, 5, 2);
|
||||||
if (intval($endDigits) > 12) return [$start, substr($datum, 0, 2) . $endDigits, "00", "00", "+", ""];
|
if (intval($endDigits) > 12) return [$start, substr($datum, 0, 2) . $endDigits, "00", "00", "+", ""];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 01.01.1920-31.12.1930
|
||||||
if (preg_match("/^01\.01\.[0-9][0-9][0-9][0-9]\-31\.12\.[0-9][0-9][0-9][0-9]$/", $datum)) { // Hungarian Y-m
|
if (preg_match("/^01\.01\.[0-9][0-9][0-9][0-9]\-31\.12\.[0-9][0-9][0-9][0-9]$/", $datum)) { // Hungarian Y-m
|
||||||
$start = substr($datum, 6, 4);
|
$start = substr($datum, 6, 4);
|
||||||
$end = substr($datum, -4);
|
$end = substr($datum, -4);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user