@@ -, +, @@ Use of uninitialized value $date_string in pattern match (m//) at Koha/DateUtils.pm line 58 --- Koha/DateUtils.pm | 2 +- t/DateUtils.t | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) --- a/Koha/DateUtils.pm +++ a/Koha/DateUtils.pm @@ -56,7 +56,7 @@ sub dt_from_string { # FIXME: see bug 13242 => no TZ for dates 'infinite' return DateTime::Format::DateParse->parse_datetime($date_string) - if $date_string =~ /^9999-/; + if $date_string and $date_string =~ /^9999-/; if ( !$tz ) { $tz = C4::Context->tz; --- a/t/DateUtils.t +++ a/t/DateUtils.t @@ -3,7 +3,7 @@ use DateTime; use DateTime::TimeZone; use C4::Context; -use Test::More tests => 41; +use Test::More tests => 42; use Test::MockModule; use Time::HiRes qw/ gettimeofday /; @@ -159,3 +159,6 @@ $date_string = output_pref({ dt => $dt, dateformat => 'metric', timeformat => '2 cmp_ok $date_string, 'eq', '11/12/2013 18:35', 'as_due_date with hours and timeformat 24hr (non-midnight time)'; $date_string = output_pref({ dt => $dt, dateformat => 'us', timeformat => '12hr', as_due_date => 1 }); cmp_ok $date_string, 'eq', '12/11/2013 06:35 PM', 'as_due_date with hours and timeformat 12hr (non-midnight time)'; + +my $now = DateTime->now; +is( dt_from_string, $now, "Without parameter, dt_from_string should return today" ); --