-my $daycount = $cal->days_between( $test_dt, $later_dt );
-cmp_ok( $daycount->in_units('days'),
- '==', 48, 'days_between calculates correctly' );
-
-my $ret;
-
-$cal->set_daysmode('Calendar');
-
-# see bugzilla #8966
-is( $cal->is_holiday($later_dt), 0, 'is holiday for the next test' );
-cmp_ok( $later_dt, 'eq', '2012-09-17T17:30:00', 'Date should be the same after is_holiday' );
-
-# example tests for bug report
-$cal->clear_weekly_closed_days();
-
-$daycount = $cal->days_between( dt_from_string('2012-01-10','iso'),
- dt_from_string("2012-05-05",'iso') )->in_units('days');
-cmp_ok( $daycount, '==', 116, 'test larger intervals' );
-$daycount = $cal->days_between( dt_from_string("2012-01-01",'iso'),
- dt_from_string("2012-05-05",'iso') )->in_units('days');
-cmp_ok( $daycount, '==', 125, 'test positive intervals' );
-my $daycount2 = $cal->days_between( dt_from_string("2012-05-05",'iso'),
- dt_from_string("2012-01-01",'iso') )->in_units('days');
-cmp_ok( $daycount2, '==', $daycount, 'test parameter order not relevant' );
-$daycount = $cal->days_between( dt_from_string("2012-07-01",'iso'),
- dt_from_string("2012-07-15",'iso') )->in_units('days');
-cmp_ok( $daycount, '==', 14, 'days_between calculates correctly' );
-$cal->add_holiday( dt_from_string('2012-07-06','iso') );
-$daycount = $cal->days_between( dt_from_string("2012-07-01",'iso'),
- dt_from_string("2012-07-15",'iso') )->in_units('days');
-cmp_ok( $daycount, '==', 13, 'holiday correctly recognized' );
-
-$cal->add_holiday( dt_from_string('2012-07-07','iso') );
-$daycount = $cal->days_between( dt_from_string("2012-07-01",'iso'),
- dt_from_string("2012-07-15",'iso') )->in_units('days');
-cmp_ok( $daycount, '==', 12, 'multiple holidays correctly recognized' );
-
-my $one_day_dur = DateTime::Duration->new( days => 1 );
-my $two_day_dur = DateTime::Duration->new( days => 2 );
-my $seven_day_dur = DateTime::Duration->new( days => 7 );
-
-subtest '\'Datedue\' tests' => sub {
- my $cal = Koha::Calendar->new( TEST_MODE => 1 ,
- days_mode => 'Datedue');
-
- $cal->add_holiday( dt_from_string('2012-07-04','iso') );
- $dt = dt_from_string( '2012-07-03','iso' );
+ is( $cal->is_holiday($later_dt), 0, 'bz-8966 (1/2) Apply is_holiday for the next test' );
+ cmp_ok( $later_dt, 'eq', '2012-09-17T17:30:00', 'bz-8966 (2/2) Date should be the same after is_holiday' );
+}
+
+
+{ # Bugzilla #8800 - is_holiday should use truncated date for 'contains' call
+ my $single_holiday_time = DateTime->new(
+ year => 2011,
+ month => 6,
+ day => 1,
+ hour => 11,
+ minute => 2
+ );
+
+ is( $cal->is_holiday($single_holiday_time),
+ $cal->is_holiday($single_holiday) ,
+ 'bz-8800 is_holiday should truncate the date for holiday validation' );
+}
+
+
+ my $one_day_dur = DateTime::Duration->new( days => 1 );
+ my $two_day_dur = DateTime::Duration->new( days => 2 );
+ my $seven_day_dur = DateTime::Duration->new( days => 7 );
+
+ my $dt = dt_from_string( '2012-07-03','iso' );
+ my $test_dt = DateTime->new( # Monday
+ year => 2012,
+ month => 7,
+ day => 23,
+ hour => 11,
+ minute => 53,
+ );
+
+ my $later_dt = DateTime->new( # Monday
+ year => 2012,
+ month => 9,
+ day => 17,
+ hour => 17,
+ minute => 30,
+ time_zone => 'Europe/London',
+ );
+
+
+{ ## 'Datedue' tests
+
+ $module_context->unmock('preference');
+ $module_context->mock(
+ 'preference',
+ sub {
+ return 'Datedue';
+ }
+ );
+ # rewind dbh session
+ $holidays_session->reset;
+
+
+ $cal = Koha::Calendar->new( branchcode => 'MPL' );