|
Lines 241-246
sub days_between {
Link Here
|
| 241 |
my $start_dt = shift; |
241 |
my $start_dt = shift; |
| 242 |
my $end_dt = shift; |
242 |
my $end_dt = shift; |
| 243 |
|
243 |
|
|
|
244 |
$start_dt->set_time_zone('UTC'); |
| 245 |
$end_dt->set_time_zone('UTC'); |
| 244 |
|
246 |
|
| 245 |
# start and end should not be closed days |
247 |
# start and end should not be closed days |
| 246 |
my $days = $start_dt->delta_days($end_dt)->delta_days; |
248 |
my $days = $start_dt->delta_days($end_dt)->delta_days; |
|
Lines 263-268
sub hours_between {
Link Here
|
| 263 |
my $duration = $end_dt->delta_ms($start_dt); |
265 |
my $duration = $end_dt->delta_ms($start_dt); |
| 264 |
$start_dt->truncate( to => 'day' ); |
266 |
$start_dt->truncate( to => 'day' ); |
| 265 |
$end_dt->truncate( to => 'day' ); |
267 |
$end_dt->truncate( to => 'day' ); |
|
|
268 |
|
| 269 |
$start_dt->set_time_zone('UTC'); |
| 270 |
$end_dt->set_time_zone('UTC'); |
| 271 |
|
| 266 |
# NB this is a kludge in that it assumes all days are 24 hours |
272 |
# NB this is a kludge in that it assumes all days are 24 hours |
| 267 |
# However for hourly loans the logic should be expanded to |
273 |
# However for hourly loans the logic should be expanded to |
| 268 |
# take into account open/close times then it would be a duration |
274 |
# take into account open/close times then it would be a duration |
| 269 |
- |
|
|