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

(-)a/Koha/DateUtils.pm (-1 / +1 lines)
Lines 115-121 sub dt_from_string { Link Here
115
    # Add the faculative time part [hh:mm[:ss]]
115
    # Add the faculative time part [hh:mm[:ss]]
116
    my $time_re .= qr|
116
    my $time_re .= qr|
117
            (
117
            (
118
                \s*
118
                \s*(T\s*)?
119
                (?<hour>\d{2})
119
                (?<hour>\d{2})
120
                :
120
                :
121
                (?<minute>\d{2})
121
                (?<minute>\d{2})
(-)a/t/DateUtils.t (-2 / +9 lines)
Lines 4-10 use DateTime::TimeZone; Link Here
4
4
5
use C4::Context;
5
use C4::Context;
6
6
7
use Test::More tests => 63;
7
use Test::More tests => 66;
8
8
9
use Test::MockModule;
9
use Test::MockModule;
10
use Test::Warn;
10
use Test::Warn;
Lines 224-229 is( output_pref( { dt => $dt, dateonly => 1 } ), '01/01/1900', 'dt_from_string s Link Here
224
$dt = dt_from_string('2015-01-31 01:02:03');
224
$dt = dt_from_string('2015-01-31 01:02:03');
225
is( output_pref( {dt => $dt} ), '31/01/2015 01:02', 'dt_from_string should fallback to sql format' );
225
is( output_pref( {dt => $dt} ), '31/01/2015 01:02', 'dt_from_string should fallback to sql format' );
226
226
227
# When T prefixes the time (like printing a datetime)
228
$dt = dt_from_string('2015-01-31T13:14:15');
229
is( $dt->hour, 13, 'Check hour from dt_from_string with T' );
230
$dt = dt_from_string('2015-01-31 T13:14:15');
231
is( $dt->minute, 14, 'Check minute from dt_from_string with \sT' );
232
$dt = dt_from_string('2015-01-31 T 13:14:15');
233
is( $dt->second, 15, 'Check second from dt_from_string with \sT\s' );
234
227
# output_pref with no parameters, single parameter (no hash)
235
# output_pref with no parameters, single parameter (no hash)
228
is( output_pref(), undef, 'Call output_pref without parameters' );
236
is( output_pref(), undef, 'Call output_pref without parameters' );
229
try {
237
try {
230
- 

Return to bug 19222