Accept an additional type of hyphen / dash in time splitting

This commit is contained in:
jrenslin committed 2025-03-10 03:59:44 +01:00
1 parent 5cce98f15b
commit 5b99304b5c
2 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -549,7 +549,7 @@ final class NodaTimeSplitter {
}
// 0000-0000
if (\preg_match("/^[0-9]{4}(\-|\/)[0-9]{4}(\.|)$/", $datum)) {
if (\preg_match("/^[0-9]{4}(\-|\/|\–)[0-9]{4}(\.|)$/", $datum)) {
return new NodaSplitTime(start_year: \substr($datum, 0, 4), end_year: \substr($datum, 5, 4));
}
+2 -2
View File
@@ -160,11 +160,11 @@ final class NodaTimeSplitterTest extends TestCase {
"1945-2046",
],
"1930–2017" => [
"1930-2017",
"1930–2017",
new NodaSplitTime('1930', '2017',
start_date: '1930-01-01',
end_date: '2017-12-31'),
"1930-2017",
"1930–2017",
],
];