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

(-)a/Koha/DateUtils.pm (-1 / +1 lines)
Lines 56-62 sub dt_from_string { Link Here
56
56
57
    # FIXME: see bug 13242 => no TZ for dates 'infinite'
57
    # FIXME: see bug 13242 => no TZ for dates 'infinite'
58
    return DateTime::Format::DateParse->parse_datetime($date_string)
58
    return DateTime::Format::DateParse->parse_datetime($date_string)
59
        if $date_string =~ /^9999-/;
59
        if $date_string and $date_string =~ /^9999-/;
60
60
61
    if ( !$tz ) {
61
    if ( !$tz ) {
62
        $tz = C4::Context->tz;
62
        $tz = C4::Context->tz;
(-)a/t/DateUtils.t (-2 / +4 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 => 41;
6
use Test::More tests => 42;
7
use Test::MockModule;
7
use Test::MockModule;
8
use Time::HiRes qw/ gettimeofday /;
8
use Time::HiRes qw/ gettimeofday /;
9
9
Lines 159-161 $date_string = output_pref({ dt => $dt, dateformat => 'metric', timeformat => '2 Link Here
159
cmp_ok $date_string, 'eq', '11/12/2013 18:35', 'as_due_date with hours and timeformat 24hr (non-midnight time)';
159
cmp_ok $date_string, 'eq', '11/12/2013 18:35', 'as_due_date with hours and timeformat 24hr (non-midnight time)';
160
$date_string = output_pref({ dt => $dt, dateformat => 'us', timeformat => '12hr', as_due_date => 1 });
160
$date_string = output_pref({ dt => $dt, dateformat => 'us', timeformat => '12hr', as_due_date => 1 });
161
cmp_ok $date_string, 'eq', '12/11/2013 06:35 PM', 'as_due_date with hours and timeformat 12hr (non-midnight time)';
161
cmp_ok $date_string, 'eq', '12/11/2013 06:35 PM', 'as_due_date with hours and timeformat 12hr (non-midnight time)';
162
- 
162
163
my $now = DateTime->now;
164
is( dt_from_string, $now, "Without parameter, dt_from_string should return today" );

Return to bug 13261