View | Details | Raw Unified | Return to bug 24850
Collapse All | Expand All

(-)a/Koha/DateUtils.pm (-2 / +9 lines)
Lines 181-190 sub dt_from_string { Link Here
181
    $dt_params{day} = '01' if $dt_params{day} eq '00';
181
    $dt_params{day} = '01' if $dt_params{day} eq '00';
182
182
183
    # Set default hh:mm:ss to 00:00:00
183
    # Set default hh:mm:ss to 00:00:00
184
    my $date_only = ( !defined( $dt_params{hour} )
185
        && !defined( $dt_params{minute} )
186
        && !defined( $dt_params{second} ) );
184
    $dt_params{hour}   = 00 unless defined $dt_params{hour};
187
    $dt_params{hour}   = 00 unless defined $dt_params{hour};
185
    $dt_params{minute} = 00 unless defined $dt_params{minute};
188
    $dt_params{minute} = 00 unless defined $dt_params{minute};
186
    $dt_params{second} = 00 unless defined $dt_params{second};
189
    $dt_params{second} = 00 unless defined $dt_params{second};
187
190
191
    my $floating = 0;
188
    my $dt = eval {
192
    my $dt = eval {
189
        DateTime->new(
193
        DateTime->new(
190
            %dt_params,
194
            %dt_params,
Lines 194-206 sub dt_from_string { Link Here
194
    };
198
    };
195
    if ($@) {
199
    if ($@) {
196
        $tz = DateTime::TimeZone->new( name => 'floating' );
200
        $tz = DateTime::TimeZone->new( name => 'floating' );
201
        $floating = 1;
197
        $dt = DateTime->new(
202
        $dt = DateTime->new(
198
            %dt_params,
203
            %dt_params,
199
            # No TZ for dates 'infinite' => see bug 13242
204
            # No TZ for dates 'infinite' => see bug 13242
200
            ( $dt_params{year} < 9999 ? ( time_zone => $tz ) : () ),
205
            ( $dt_params{year} < 9999 ? ( time_zone => $tz ) : () ),
201
        );
206
        );
202
    }
207
    }
203
    $dt->set_time_zone($server_tz);
208
209
    # Convert to configured timezone (unless we started with a dateonly string or had to drop to floating time)
210
    $dt->set_time_zone($server_tz) unless ( $date_only || $floating );
211
204
    return $dt;
212
    return $dt;
205
}
213
}
206
214
207
- 

Return to bug 24850