From 110eeb34faab6f16f8d5d4a90aa513620497e622 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 7 Jun 2022 19:51:29 +1200 Subject: [PATCH] dev/core#2325 Fix handling of seconds on import This addresses an issue where the following date time has the time component stripped 2012-12-12 07:12:56 Without the seconds - ie 2012-12-12 07:12 Note that I do have a test in a PR for the import where --- CRM/Utils/Date.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CRM/Utils/Date.php b/CRM/Utils/Date.php index ddbc21e65257..98e723f60f10 100644 --- a/CRM/Utils/Date.php +++ b/CRM/Utils/Date.php @@ -2125,7 +2125,7 @@ public static function formatDate($date, $dateType) { $ruleName = 'date'; if ($dateType == 1) { $matches = []; - if (preg_match("/(\s(([01]\d)|[2][0-3]):([0-5]\d))$/", $date, $matches)) { + if (preg_match("/(\s(([01]\d)|[2][0-3]):([0-5]\d):?[0-5]?\d?)$/", $date, $matches)) { $ruleName = 'dateTime'; if (strpos($date, '-') !== FALSE) { $dateVal .= array_shift($matches);