From 80e7c31f23014f6e8fae69bbff088cd2883c9c43 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 11 Mar 2020 17:55:34 +0000 Subject: [PATCH] Bug 24850: Don't fallback when rfc3339 format is passed --- Koha/DateUtils.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Koha/DateUtils.pm b/Koha/DateUtils.pm index cc474a6ddb..a408451b11 100644 --- a/Koha/DateUtils.pm +++ b/Koha/DateUtils.pm @@ -117,7 +117,7 @@ sub dt_from_string { (?\d{2}) : (?\d{2}) - (\.\d{1,3})?(([Zz])|((?[\+|\-])(?[01][0-9]|2[0-3]):(?[0-5][0-9]))) + (\.\d{1,3})?(([Zz]$)|((?[\+|\-])(?[01][0-9]|2[0-3]):(?[0-5][0-9]))) /xms; } elsif ( $date_format eq 'iso' or $date_format eq 'sql' ) { @@ -141,7 +141,7 @@ sub dt_from_string { )? )? |xms; - $regex .= $time_re; + $regex .= $time_re unless ( $date_format eq 'rfc3339' ); $fallback_re .= $time_re; my %dt_params; @@ -157,7 +157,7 @@ sub dt_from_string { if ( $+{offset} ) { $tz = DateTime::TimeZone->new( name => $+{offset} . $+{hours} . $+{minutes} ); } - } elsif ( $date_string =~ $fallback_re ) { + } elsif ( ($date_format ne 'rfc3339') && ($date_string =~ $fallback_re) ) { %dt_params = ( year => $+{year}, month => $+{month}, -- 2.20.1