dev/core#2325 Fix handling of seconds on import
authorEileen McNaughton <emcnaughton@wikimedia.org>
Tue, 7 Jun 2022 07:51:29 +0000 (19:51 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Tue, 7 Jun 2022 07:51:32 +0000 (19:51 +1200)
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

index ddbc21e652578ad9d8bde19ea617547945a6646f..98e723f60f10725e27497c1ea1732920bc871cc6 100644 (file)
@@ -2125,7 +2125,7 @@ class CRM_Utils_Date {
       $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);