[Koha-patches] [PATCH 2/3] Bug 8418 - fix dt->truncate( to => 'day' )

Dobrica Pavlinusic dpavlin at rot13.org
Wed Jul 11 19:45:14 CEST 2012


---
 Koha/Calendar.pm |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Koha/Calendar.pm b/Koha/Calendar.pm
index ab01e53..2c372f2 100644
--- a/Koha/Calendar.pm
+++ b/Koha/Calendar.pm
@@ -147,7 +147,7 @@ sub is_holiday {
     if ( $self->{weekly_closed_days}->[$dow] == 1 ) {
         return 1;
     }
-    $dt->truncate( to => 'days' );
+    $dt->truncate( to => 'day' );
     my $day   = $dt->day;
     my $month = $dt->month;
     if ( exists $self->{day_month_closed_days}->{$day}->{$month} ) {
@@ -189,8 +189,8 @@ sub days_between {
 sub hours_between {
     my ($self, $start_dt, $end_dt) = @_;
     my $duration = $end_dt->delta_ms($start_dt);
-    $start_dt->truncate( to => 'days' );
-    $end_dt->truncate( to => 'days' );
+    $start_dt->truncate( to => 'day' );
+    $end_dt->truncate( to => 'day' );
     # NB this is a kludge in that it assumes all days are 24 hours
     # However for hourly loans the logic should be expanded to
     # take into account open/close times then it would be a duration
-- 
1.7.2.5



More information about the Koha-patches mailing list