Lines 59-64
sub dt_from_string {
Link Here
|
59 |
|
59 |
|
60 |
return if $date_string and $date_string =~ m|^0000-0|; |
60 |
return if $date_string and $date_string =~ m|^0000-0|; |
61 |
|
61 |
|
|
|
62 |
my $do_fallback = defined($date_format) ? 0 : 1; |
62 |
$tz = C4::Context->tz unless $tz;; |
63 |
$tz = C4::Context->tz unless $tz;; |
63 |
|
64 |
|
64 |
return DateTime->now( time_zone => $tz ) unless $date_string; |
65 |
return DateTime->now( time_zone => $tz ) unless $date_string; |
Lines 123-129
sub dt_from_string {
Link Here
|
123 |
(?<minute>\d{2}) |
124 |
(?<minute>\d{2}) |
124 |
: |
125 |
: |
125 |
(?<second>\d{2}) |
126 |
(?<second>\d{2}) |
126 |
(\.\d{1,3})?(([Zz])|((?<offset>[\+|\-])(?<hours>[01][0-9]|2[0-3]):(?<minutes>[0-5][0-9]))) |
127 |
(\.\d{1,3})?(([Zz]$)|((?<offset>[\+|\-])(?<hours>[01][0-9]|2[0-3]):(?<minutes>[0-5][0-9]))) |
127 |
/xms; |
128 |
/xms; |
128 |
} |
129 |
} |
129 |
elsif ( $date_format eq 'iso' or $date_format eq 'sql' ) { |
130 |
elsif ( $date_format eq 'iso' or $date_format eq 'sql' ) { |
Lines 151-157
sub dt_from_string {
Link Here
|
151 |
)? |
152 |
)? |
152 |
)? |
153 |
)? |
153 |
|xms; |
154 |
|xms; |
154 |
$regex .= $time_re; |
155 |
$regex .= $time_re unless ( $date_format eq 'rfc3339' ); |
155 |
$fallback_re .= $time_re; |
156 |
$fallback_re .= $time_re; |
156 |
|
157 |
|
157 |
my %dt_params; |
158 |
my %dt_params; |
Lines 169-175
sub dt_from_string {
Link Here
|
169 |
if ( $+{offset} ) { |
170 |
if ( $+{offset} ) { |
170 |
$tz = DateTime::TimeZone->new( name => $+{offset} . $+{hours} . $+{minutes} ); |
171 |
$tz = DateTime::TimeZone->new( name => $+{offset} . $+{hours} . $+{minutes} ); |
171 |
} |
172 |
} |
172 |
} elsif ( $date_string =~ $fallback_re ) { |
173 |
} elsif ( $do_fallback && $date_string =~ $fallback_re ) { |
173 |
%dt_params = ( |
174 |
%dt_params = ( |
174 |
year => $+{year}, |
175 |
year => $+{year}, |
175 |
month => $+{month}, |
176 |
month => $+{month}, |
176 |
- |
|
|