From 7bc5bdf3356626db285123a11f987ece19dd3175 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Thu, 24 Sep 2020 17:59:15 +0200 Subject: [PATCH] Allow parsing of "1910-1925." --- src/NodaTimeSplitter.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/NodaTimeSplitter.php b/src/NodaTimeSplitter.php index 94b29c0..b11b768 100644 --- a/src/NodaTimeSplitter.php +++ b/src/NodaTimeSplitter.php @@ -463,9 +463,11 @@ final class NodaTimeSplitter { $datum = self::clean_input($datum); - if (preg_match("/^[0-9][0-9][0-9][0-9](\-|\/)[0-9][0-9][0-9][0-9]$/", $datum)) { + if (preg_match("/^[0-9][0-9][0-9][0-9](\-|\/)[0-9][0-9][0-9][0-9]$/", $datum) + || preg_match("/^[0-9][0-9][0-9][0-9](\-|\/)[0-9][0-9][0-9][0-9]\.$/", $datum) + ) { $start = substr($datum, 0, 4); - $end = substr($datum, -4); + $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]$/", $datum)) { // German T.MM.JJJJ