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

(-)a/Koha/DateUtils.pm (-1 / +3 lines)
Lines 105-111 sub dt_from_string { Link Here
105
    }
105
    }
106
106
107
    # Add the faculative time part [hh:mm[:ss]]
107
    # Add the faculative time part [hh:mm[:ss]]
108
    $regex .= qr|
108
    my $time_re .= qr|
109
            (
109
            (
110
                \s*
110
                \s*
111
                (?<hour>\d{2})
111
                (?<hour>\d{2})
Lines 117-122 sub dt_from_string { Link Here
117
                )?
117
                )?
118
            )?
118
            )?
119
    |xms;
119
    |xms;
120
    $regex .= $time_re;
121
    $fallback_re .= $time_re;
120
122
121
    my %dt_params;
123
    my %dt_params;
122
    if ( $date_string =~ $regex ) {
124
    if ( $date_string =~ $regex ) {
(-)a/t/DateUtils.t (-2 / +5 lines)
Lines 3-9 use DateTime; Link Here
3
use DateTime::TimeZone;
3
use DateTime::TimeZone;
4
4
5
use C4::Context;
5
use C4::Context;
6
use Test::More tests => 54;
6
use Test::More tests => 55;
7
use Test::MockModule;
7
use Test::MockModule;
8
use Time::HiRes qw/ gettimeofday /;
8
use Time::HiRes qw/ gettimeofday /;
9
use t::lib::Mocks;
9
use t::lib::Mocks;
Lines 211-213 is( output_pref( { dt => $dt } ), '31/01/2015 12:34', 'dt_from_string should mat Link Here
211
# date before 1900
211
# date before 1900
212
$dt = dt_from_string('01/01/1900');
212
$dt = dt_from_string('01/01/1900');
213
is( output_pref( { dt => $dt, dateonly => 1 } ), '01/01/1900', 'dt_from_string should manage date < 1900' );
213
is( output_pref( { dt => $dt, dateonly => 1 } ), '01/01/1900', 'dt_from_string should manage date < 1900' );
214
- 
214
215
# fallback
216
$dt = dt_from_string('2015-01-31 01:02:03');
217
is( output_pref( {dt => $dt} ), '31/01/2015 01:02', 'dt_from_string should fallback to sql format' );

Return to bug 13601