|
Lines 176-185
sub days_between {
Link Here
|
| 176 |
$datestart_temp->truncate( to => 'day' ); |
176 |
$datestart_temp->truncate( to => 'day' ); |
| 177 |
$dateend_temp->truncate( to => 'day' ); |
177 |
$dateend_temp->truncate( to => 'day' ); |
| 178 |
my $duration = $dateend_temp - $datestart_temp; |
178 |
my $duration = $dateend_temp - $datestart_temp; |
| 179 |
while ( DateTime->compare( $datestart_temp, $dateend_temp ) == -1 ) { |
179 |
# if borrower is not late, delta days must be negative |
| 180 |
$datestart_temp->add( days => 1 ); |
180 |
if(DateTime->compare( $start_dt, $end_dt ) > -1){ |
| 181 |
if ( $self->is_holiday($datestart_temp) ) { |
181 |
$duration = $duration->inverse; |
| 182 |
$duration->subtract( days => 1 ); |
182 |
} else { |
|
|
183 |
while ( DateTime->compare( $datestart_temp, $dateend_temp ) == -1 ) { |
| 184 |
$datestart_temp->add( days => 1 ); |
| 185 |
if ( $self->is_holiday($datestart_temp) ) { |
| 186 |
$duration->subtract( days => 1 ); |
| 187 |
} |
| 183 |
} |
188 |
} |
| 184 |
} |
189 |
} |
| 185 |
return $duration; |
190 |
return $duration; |
| 186 |
- |
|
|