@@ -, +, @@ day's open hours --- C4/Circulation.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/C4/Circulation.pm +++ a/C4/Circulation.pm @@ -3734,10 +3734,13 @@ sub CalcDateDue { # starter vars so don't do calculations directly to $datedue my $potential_datedue = $datedue->clone; my $library_close = $datedue->clone; - my $dayofweek = $datedue->local_day_of_week - 1; + my $dayofweek = $datedue->day_of_week - 1; + my $tomorrow_dayofweek = $dayofweek + 1; + # If it's Sunday and tomorrow would be == 7, make tomorrow 0 (Days are stored as 0-6) + if ( $tomorrow_dayofweek > 6 ) { $tomorrow_dayofweek = 0; } my $todayhours = Koha::Library::Hours->find({ branchcode => $branch, day => $dayofweek }); my @close = undef; - my $tomorrowhours = Koha::Library::Hours->find({ branchcode => $branch, day => $dayofweek+1 }); # get open hours of next day + my $tomorrowhours = Koha::Library::Hours->find({ branchcode => $branch, day => $tomorrow_dayofweek }); # get open hours of next day my @open = undef; if ( $todayhours->close_time and $tomorrowhours->open_time ) { @close = split( ":", $todayhours->close_time ); --