Bug 19176: Reduce the number of seconds to 5
Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
dfcb2b8071
commit
f0e737f43a
|
|
@ -14,7 +14,7 @@ is( t::lib::Dates::compare( $dt_2, $dt_1 ), 1, '2018 is after 2017' );
|
|||
is( t::lib::Dates::compare( $date_1, $date_2 ), -1, '2017 is before 2018 (strings comparison)' );
|
||||
is( t::lib::Dates::compare( $date_2, $date_1 ), 1, '2018 is after 2017 (strings comparison)' );
|
||||
|
||||
my $dt_3 = $dt_1->clone->subtract( seconds => 59 );
|
||||
my $dt_3 = $dt_1->clone->subtract( seconds => 5 );
|
||||
is( t::lib::Dates::compare( $dt_1, $dt_3 ),
|
||||
0, 'If there is less than 1min, the dates are considered identicals' );
|
||||
is( t::lib::Dates::compare( $dt_3, $dt_1 ),
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ sub compare {
|
|||
$dt_got->set_time_zone('floating');
|
||||
$dt_expected->set_time_zone('floating');
|
||||
my $diff = $dt_got->epoch - $dt_expected->epoch;
|
||||
if ( abs($diff) < 60 ) { return 0 }
|
||||
if ( abs($diff) < 6 ) { return 0 }
|
||||
return $diff > 0 ? 1 : -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue