Lines 117-123
sub dt_from_string {
Link Here
|
117 |
(?<minute>\d{2}) |
117 |
(?<minute>\d{2}) |
118 |
: |
118 |
: |
119 |
(?<second>\d{2}) |
119 |
(?<second>\d{2}) |
120 |
(\.\d{1,3})?(([Zz])|([\+|\-]([01][0-9]|2[0-3]):[0-5][0-9])) |
120 |
(\.\d{1,3})?(([Zz])|((?<offset>[\+|\-])(?<hours>[01][0-9]|2[0-3]):(?<minutes>[0-5][0-9]))) |
121 |
/xms; |
121 |
/xms; |
122 |
} |
122 |
} |
123 |
elsif ( $date_format eq 'iso' or $date_format eq 'sql' ) { |
123 |
elsif ( $date_format eq 'iso' or $date_format eq 'sql' ) { |
Lines 160-165
sub dt_from_string {
Link Here
|
160 |
second => $+{second}, |
160 |
second => $+{second}, |
161 |
); |
161 |
); |
162 |
$ampm = $+{ampm}; |
162 |
$ampm = $+{ampm}; |
|
|
163 |
if ( $+{offset} ) { |
164 |
$tz = DateTime::TimeZone->new( name => $+{offset} . $+{hours} . $+{minutes} ); |
165 |
} |
163 |
} elsif ( $date_string =~ $fallback_re ) { |
166 |
} elsif ( $date_string =~ $fallback_re ) { |
164 |
%dt_params = ( |
167 |
%dt_params = ( |
165 |
year => $+{year}, |
168 |
year => $+{year}, |
Lines 196-202
sub dt_from_string {
Link Here
|
196 |
DateTime->new( |
199 |
DateTime->new( |
197 |
%dt_params, |
200 |
%dt_params, |
198 |
# No TZ for dates 'infinite' => see bug 13242 |
201 |
# No TZ for dates 'infinite' => see bug 13242 |
199 |
( $dt_params{year} < 9999 ? ( time_zone => $tz->name ) : () ), |
202 |
( $dt_params{year} < 9999 ? ( time_zone => $tz ) : () ), |
200 |
); |
203 |
); |
201 |
}; |
204 |
}; |
202 |
if ($@) { |
205 |
if ($@) { |
Lines 204-210
sub dt_from_string {
Link Here
|
204 |
$dt = DateTime->new( |
207 |
$dt = DateTime->new( |
205 |
%dt_params, |
208 |
%dt_params, |
206 |
# No TZ for dates 'infinite' => see bug 13242 |
209 |
# No TZ for dates 'infinite' => see bug 13242 |
207 |
( $dt_params{year} < 9999 ? ( time_zone => $tz->name ) : () ), |
210 |
( $dt_params{year} < 9999 ? ( time_zone => $tz ) : () ), |
208 |
); |
211 |
); |
209 |
} |
212 |
} |
210 |
return $dt; |
213 |
return $dt; |
211 |
- |
|
|