else { # days
$dur = DateTime::Duration->new( days => $loanlength->{$length_key});
}
##my $calendar = Koha::DiscreteCalendar->new({ branchcode => $branch, days_mode => $daysmode });
$datedue = $calendar->addDuration( $datedue, $dur, $loanlength->{lengthunit} );
if ($loanlength->{lengthunit} eq 'days') {
$datedue->set_hour(23);
-