Lines 23-29
use t::lib::TestBuilder;
Link Here
|
23 |
use DateTime; |
23 |
use DateTime; |
24 |
use Koha::Caches; |
24 |
use Koha::Caches; |
25 |
use Koha::DateUtils; |
25 |
use Koha::DateUtils; |
26 |
use POSIX qw(tzset); |
|
|
27 |
|
26 |
|
28 |
use_ok('Koha::Calendar'); |
27 |
use_ok('Koha::Calendar'); |
29 |
|
28 |
|
Lines 71-85
subtest 'crossing_DST' => sub {
Link Here
|
71 |
|
70 |
|
72 |
plan tests => 2; |
71 |
plan tests => 2; |
73 |
|
72 |
|
74 |
$ENV{TZ} = 'America/New_York'; |
73 |
my $tz = DateTime::TimeZone->new( name => 'America/New_York' ); |
75 |
tzset; |
|
|
76 |
my $tz = DateTime::TimeZone->new( name => 'local' ); |
77 |
my $start_date = dt_from_string( "2016-03-09 02:29:00",undef,$tz ); |
74 |
my $start_date = dt_from_string( "2016-03-09 02:29:00",undef,$tz ); |
78 |
my $end_date = dt_from_string("2017-01-01"); |
75 |
my $end_date = dt_from_string( "2017-01-01 00:00:00", undef, $tz ); |
79 |
my $days_between = $calendar->days_between($start_date,$end_date); |
76 |
my $days_between = $calendar->days_between($start_date,$end_date); |
80 |
is($days_between->{days}, 298, "Days calculated correctly"); |
77 |
is( $days_between->delta_days, 298, "Days calculated correctly" ); |
81 |
my $hours_between = $calendar->hours_between($start_date,$end_date); |
78 |
my $hours_between = $calendar->hours_between($start_date,$end_date); |
82 |
is($hours_between->{minutes}, 428671, "Hours (in minutes) calculated correctly"); |
79 |
is( $hours_between->delta_minutes, 298 * 24 * 60 - 149, "Hours (in minutes) calculated correctly" ); |
83 |
|
80 |
|
84 |
}; |
81 |
}; |
85 |
|
82 |
|
86 |
- |
|
|