From f9543e92e7fe8a59a21211ef807936b48222bbc1 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 24 May 2023 19:00:51 +0200 Subject: [PATCH] wip #5877 --- src/MatomoUtils.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/MatomoUtils.php diff --git a/src/MatomoUtils.php b/src/MatomoUtils.php new file mode 100644 index 0000000..03a0ec3 --- /dev/null +++ b/src/MatomoUtils.php @@ -0,0 +1,27 @@ +(?2\d{3})-?(?0[1-9]|1[012])?-?(?0[1-9]|[12][0-9]|3[01])?),?(?2\d{3}-(?>0[1-9]|1[012])-(?>0[1-9]|[12][0-9]|3[01]))?/'; + + preg_match($regex, $date, $date_matches); + + extract($date_matches); // Just for easier access to match variables + + // Bail out on nonsensical dates + if (isset($start_date) && isset($end_date) && ($start_date > $end_date)) { + return false; + } + + return $date_matches; + } +} -- 2.39.5