Bug 9031: Overdue items crossing DST boundary throw invalid local time exception
authorNick Clemens <nick@bywatersolutions.com>
Tue, 14 Mar 2017 16:46:28 +0000 (12:46 -0400)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 27 Oct 2017 17:09:03 +0000 (14:09 -0300)
To test:
1 - Set TZ to America/New York
2 - Checkout item and set due date to '2016-03-09 02:29:00"
3 - Make sure fines are set for the item type, fine mode production,
  calculate fines on return
4 - Check in item - invalid date time warning in logs
5 - Apply patch
6 - Check in item - no error
7 - prove t/Calendar.t

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 9031: Use floating instead of UTC

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Squashed the changes for Calendar.pm; will add a follow-up to finally
overcoming the crash on Invalid local time.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/Calendar.pm

index 67d2a6b..f6a276f 100644 (file)
@@ -327,7 +327,7 @@ sub days_between {
 
     # start and end should not be closed days
     my $days = $start_dt->delta_days($end_dt)->delta_days;
-    for (my $dt = $start_dt->clone();
+    for (my $dt = $start_dt->clone()->set_time_zone('floating');
         $dt <= $end_dt;
         $dt->add(days => 1)
     ) {
@@ -351,7 +351,7 @@ sub hours_between {
     # take into account open/close times then it would be a duration
     # of library open hours
     my $skipped_days = 0;
-    for (my $dt = $start_dt->clone();
+    for (my $dt = $start_dt->clone()->set_time_zone('floating');
         $dt <= $end_dt;
         $dt->add(days => 1)
     ) {