Lines 344-364
sub hours_between {
Link Here
|
344 |
# However for hourly loans the logic should be expanded to |
344 |
# However for hourly loans the logic should be expanded to |
345 |
# take into account open/close times then it would be a duration |
345 |
# take into account open/close times then it would be a duration |
346 |
# of library open hours |
346 |
# of library open hours |
|
|
347 |
# start and end should not be closed days |
347 |
my $skipped_days = 0; |
348 |
my $skipped_days = 0; |
348 |
for (my $dt = $start_dt->clone(); |
349 |
while( $start_dt->compare($end_dt) < 1 ) { |
349 |
$dt <= $end_dt; |
350 |
$start_dt->add( days => 1 ); |
350 |
$dt->add(days => 1) |
351 |
$skipped_days++ if $self->is_holiday($start_dt); |
351 |
) { |
|
|
352 |
if ($self->is_holiday($dt)) { |
353 |
++$skipped_days; |
354 |
} |
355 |
} |
352 |
} |
356 |
if ($skipped_days) { |
353 |
if ($skipped_days) { |
357 |
$duration->subtract_duration(DateTime::Duration->new( hours => 24 * $skipped_days)); |
354 |
$duration->subtract_duration(DateTime::Duration->new( hours => 24 * $skipped_days)); |
358 |
} |
355 |
} |
359 |
|
356 |
|
360 |
return $duration; |
357 |
return $duration; |
361 |
|
|
|
362 |
} |
358 |
} |
363 |
|
359 |
|
364 |
sub set_daysmode { |
360 |
sub set_daysmode { |
365 |
- |
|
|