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 154-159
sub dt_from_string {
Link Here
|
154 |
minute => $+{minute}, |
154 |
minute => $+{minute}, |
155 |
second => $+{second}, |
155 |
second => $+{second}, |
156 |
); |
156 |
); |
|
|
157 |
if ( $+{offset} ) { |
158 |
$tz = DateTime::TimeZone->new( name => $+{offset} . $+{hours} . $+{minutes} ); |
159 |
} |
157 |
} elsif ( $date_string =~ $fallback_re ) { |
160 |
} elsif ( $date_string =~ $fallback_re ) { |
158 |
%dt_params = ( |
161 |
%dt_params = ( |
159 |
year => $+{year}, |
162 |
year => $+{year}, |
Lines 180-186
sub dt_from_string {
Link Here
|
180 |
DateTime->new( |
183 |
DateTime->new( |
181 |
%dt_params, |
184 |
%dt_params, |
182 |
# No TZ for dates 'infinite' => see bug 13242 |
185 |
# No TZ for dates 'infinite' => see bug 13242 |
183 |
( $dt_params{year} < 9999 ? ( time_zone => $tz->name ) : () ), |
186 |
( $dt_params{year} < 9999 ? ( time_zone => $tz ) : () ), |
184 |
); |
187 |
); |
185 |
}; |
188 |
}; |
186 |
if ($@) { |
189 |
if ($@) { |
Lines 188-194
sub dt_from_string {
Link Here
|
188 |
$dt = DateTime->new( |
191 |
$dt = DateTime->new( |
189 |
%dt_params, |
192 |
%dt_params, |
190 |
# No TZ for dates 'infinite' => see bug 13242 |
193 |
# No TZ for dates 'infinite' => see bug 13242 |
191 |
( $dt_params{year} < 9999 ? ( time_zone => $tz->name ) : () ), |
194 |
( $dt_params{year} < 9999 ? ( time_zone => $tz ) : () ), |
192 |
); |
195 |
); |
193 |
} |
196 |
} |
194 |
return $dt; |
197 |
return $dt; |
195 |
- |
|
|