From: Vincent Vanwaelscappel Date: Wed, 24 May 2023 17:00:51 +0000 (+0200) Subject: wip #5877 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=f9543e92e7fe8a59a21211ef807936b48222bbc1;p=cubist_matomo.git wip #5877 --- 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; + } +}