Fix backdate near DST changes
authorThomas Berezansky <tsbere@mvlc.org>
Fri, 2 Nov 2012 13:53:30 +0000 (09:53 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Wed, 16 Jan 2013 00:46:42 +0000 (19:46 -0500)
When the due date and the backdate date are on opposite sides of a DST
boundary we were getting an hour off on the checkin time (using the
original due date's time).

This commit changes it so that instead we just set the hour and minute
values on the backdate date to the due date's versions, leaving the time
zone alone.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm

index 83a46a8..273978e 100644 (file)
@@ -3500,7 +3500,9 @@ sub checkin_handle_backdate {
     my $bd = cleanse_ISO8601($self->backdate);
     my $original_date = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($self->circ->due_date));
     my $new_date = DateTime::Format::ISO8601->new->parse_datetime($bd);
-    $bd = cleanse_ISO8601($new_date->ymd . 'T' . $original_date->strftime('%T%z'));
+    $new_date->set_hour($original_date->hour());
+    $new_date->set_minute($original_date->minute());
+    $bd = cleanse_ISO8601($new_date->datetime());
 
     $self->backdate($bd);
     return undef;