From 874cfb8a6f540a6d3e07e9c14fb8455d4f202035 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Fri, 7 May 2021 16:25:50 +0200 Subject: [PATCH] Extend time splitter to handle e.g. "17./18. Jh." --- src/NodaTimeSplitter.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/NodaTimeSplitter.php b/src/NodaTimeSplitter.php index 152004f..72d52ac 100644 --- a/src/NodaTimeSplitter.php +++ b/src/NodaTimeSplitter.php @@ -912,7 +912,10 @@ final class NodaTimeSplitter { } // 17.-18. Jahrhundert - if (\preg_match("/^[0-9]{2}(\.|)(|\ Jh\.||\ Jahrhundert||\ sz||\ század)\-[0-9]{2}\.\ (Jh\.|Jahrhundert|sz|század)$/", $datum)) { + if (\preg_match("/^[0-9]{2}(\.|)(|\ Jh\.||\ Jahrhundert||\ sz||\ század)(\-|\/)[0-9]{2}\.\ (Jh\.|Jahrhundert|sz|század)$/", $datum)) { + if (\strpos($datum, '/') !== false) { + $datum = str_replace('/', '-', $datum); + } if (($dashPos = \strpos($datum, "-")) !== false) { return self::negotiate_century_span_bce_ce(\substr($datum, 0, 2), \substr($datum, $dashPos + 1, 2)); }