use DateTime::TimeZone;
use C4::Context;
use Test::More tests => 42;
use Test::More tests => 45;
use Test::MockModule;
use Time::HiRes qw/ gettimeofday /;
my $now = DateTime->now;
is( dt_from_string, $now, "Without parameter, dt_from_string should return today" );
-
# Test dt_from_string
$module_context->mock(
'preference',
sub {
return 'metric';
}
);
$dt = dt_from_string( '31/01/2015' );
is( ref($dt), 'DateTime' );
$dt = eval { dt_from_string( '31/01/2015', 'iso' ); };
is( ref($dt), '' );
$dt = eval { dt_from_string( '01/01/2015', 'iso' ); };