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

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

Return to bug 24850