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

(-)a/Koha/DateUtils.pm (-2 / +9 lines)
Lines 194-199 sub dt_from_string { Link Here
194
    $dt_params{day} = '01' if $dt_params{day} eq '00';
194
    $dt_params{day} = '01' if $dt_params{day} eq '00';
195
195
196
    # Set default hh:mm:ss to 00:00:00
196
    # Set default hh:mm:ss to 00:00:00
197
    my $date_only = ( !defined( $dt_params{hour} )
198
        && !defined( $dt_params{minute} )
199
        && !defined( $dt_params{second} ) );
197
    $dt_params{hour}   = 00 unless defined $dt_params{hour};
200
    $dt_params{hour}   = 00 unless defined $dt_params{hour};
198
    $dt_params{minute} = 00 unless defined $dt_params{minute};
201
    $dt_params{minute} = 00 unless defined $dt_params{minute};
199
    $dt_params{second} = 00 unless defined $dt_params{second};
202
    $dt_params{second} = 00 unless defined $dt_params{second};
Lines 207-212 sub dt_from_string { Link Here
207
        }
210
        }
208
    }
211
    }
209
212
213
    my $floating = 0;
210
    my $dt = eval {
214
    my $dt = eval {
211
        DateTime->new(
215
        DateTime->new(
212
            %dt_params,
216
            %dt_params,
Lines 216-228 sub dt_from_string { Link Here
216
    };
220
    };
217
    if ($@) {
221
    if ($@) {
218
        $tz = DateTime::TimeZone->new( name => 'floating' );
222
        $tz = DateTime::TimeZone->new( name => 'floating' );
223
        $floating = 1;
219
        $dt = DateTime->new(
224
        $dt = DateTime->new(
220
            %dt_params,
225
            %dt_params,
221
            # No TZ for dates 'infinite' => see bug 13242
226
            # No TZ for dates 'infinite' => see bug 13242
222
            ( $dt_params{year} < 9999 ? ( time_zone => $tz ) : () ),
227
            ( $dt_params{year} < 9999 ? ( time_zone => $tz ) : () ),
223
        );
228
        );
224
    }
229
    }
225
    $dt->set_time_zone($server_tz);
230
231
    # Convert to configured timezone (unless we started with a dateonly string or had to drop to floating time)
232
    $dt->set_time_zone($server_tz) unless ( $date_only || $floating );
233
226
    return $dt;
234
    return $dt;
227
}
235
}
228
236
229
- 

Return to bug 24850