LP#1321429: Use server-local time as best-guess
authorMike Rylander <mrylander@gmail.com>
Tue, 20 May 2014 18:30:20 +0000 (14:30 -0400)
committerBen Shum <bshum@biblio.org>
Thu, 22 May 2014 01:37:08 +0000 (21:37 -0400)
When first calculating the shelf expire time, we assume "now" as
the starting point by calling DateTime->now().  However, that gives
us the time in UTC.  That's not good because closed dates are stored
timezone-aware.  Instead, ask for server-local time.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm

index 45b2133..794f2dd 100644 (file)
@@ -1110,7 +1110,7 @@ sub set_hold_shelf_expire_time {
 
     $start_time = ($start_time) ?
         DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($start_time)) :
-        DateTime->now;
+        DateTime->now(time_zone => 'local'); # without time_zone we get UTC ... yuck!
 
     my $seconds = OpenSRF::Utils->interval_to_seconds($shelf_expire);
     my $expire_time = $start_time->add(seconds => $seconds);