[Rt-commit] rt branch, 4.4/extend-iso-date-format, created. rt-4.4.2-68-g07a6e546f

? sunnavy sunnavy at bestpractical.com
Wed Jan 31 14:55:18 EST 2018


The branch, 4.4/extend-iso-date-format has been created
        at  07a6e546f267eaee64715299e2dfcdd10b7d0301 (commit)

- Log -----------------------------------------------------------------
commit 4c98fcb4de23b10172d9bf390db1a70f2f8d8dda
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Wed Jan 24 14:38:21 2018 -0500

    Accept an optional T in ISO date format
    
    ISO 8601 allows for a T as part of a combined date
    and time format, so accept this when setting an ISO date
    format.

diff --git a/lib/RT/Date.pm b/lib/RT/Date.pm
index 0ef60772e..9eff35ccb 100644
--- a/lib/RT/Date.pm
+++ b/lib/RT/Date.pm
@@ -183,8 +183,8 @@ sub Set {
     elsif ( $format =~ /^(sql|datemanip|iso)$/ ) {
         $args{'Value'} =~ s!/!-!g;
 
-        if (   ( $args{'Value'} =~ /^(\d{4})?(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/ )
-            || ( $args{'Value'} =~ /^(\d{4})?(\d\d)(\d\d)(\d\d):(\d\d):(\d\d)$/ )
+        if (   ( $args{'Value'} =~ /^(\d{4})?(\d\d)(\d\d)T?+(\d\d)(\d\d)(\d\d)$/ )
+            || ( $args{'Value'} =~ /^(\d{4})?(\d\d)(\d\d)T?+(\d\d):(\d\d):(\d\d)$/ )
             || ( $args{'Value'} =~ /^(?:(\d{4})-)?(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)$/ )
             || ( $args{'Value'} =~ /^(?:(\d{4})-)?(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)\+00$/ )
           ) {

commit 07a6e546f267eaee64715299e2dfcdd10b7d0301
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Wed Jan 24 14:41:02 2018 -0500

    Tests for ISO date format with T delimiter

diff --git a/t/api/date.t b/t/api/date.t
index 4a3851e68..a096e1d30 100644
--- a/t/api/date.t
+++ b/t/api/date.t
@@ -304,15 +304,27 @@ my $year = (localtime(time))[5] + 1900;
     $date->Set(Format => 'ISO', Value => '20051128151000');
     is($date->ISO, '2005-11-28 15:10:00', "YYYYDDMMhhmmss");
 
+    $date->Set(Format => 'ISO', Value => '20051128T151000');
+    is($date->ISO, '2005-11-28 15:10:00', "YYYYDDMMThhmmss");
+
     $date->Set(Format => 'ISO', Value => '1128151000');
     is($date->ISO, $year .'-11-28 15:10:00', "DDMMhhmmss");
 
+    $date->Set(Format => 'ISO', Value => '1128T151000');
+    is($date->ISO, $year .'-11-28 15:10:00', "DDMMThhmmss");
+
     $date->Set(Format => 'ISO', Value => '2005112815:10:00');
     is($date->ISO, '2005-11-28 15:10:00', "YYYYDDMMhh:mm:ss");
 
+    $date->Set(Format => 'ISO', Value => '20051128T15:10:00');
+    is($date->ISO, '2005-11-28 15:10:00', "YYYYDDMMThh:mm:ss");
+
     $date->Set(Format => 'ISO', Value => '112815:10:00');
     is($date->ISO, $year .'-11-28 15:10:00', "DDMMhh:mm:ss");
 
+    $date->Set(Format => 'ISO', Value => '1128T15:10:00');
+    is($date->ISO, $year .'-11-28 15:10:00', "DDMMThh:mm:ss");
+
     warning_like {
         $date->Set(Format => 'ISO', Value => '2005-13-28 15:10:00');
     } qr/Invalid date/;

-----------------------------------------------------------------------


More information about the rt-commit mailing list