10 t::lib::Dates.pm - test helper module for working with dates
16 compare( $got_dt, $expected_dt, $test_description );
18 Will execute a test and compare the 2 dates given in parameters
19 The date will be compared truncated to minutes
24 my ( $got, $expected, $description ) = @_;
25 my $dt_got = dt_from_string($got);
26 my $dt_expected = dt_from_string($expected);
27 $dt_got->set_time_zone('floating');
28 $dt_expected->set_time_zone('floating');
29 my $diff = $dt_got->epoch - $dt_expected->epoch;
30 if ( abs($diff) < 6 ) { return 0 }
31 return $diff > 0 ? 1 : -1;