LP#1386260: DST bugs in perl live tests (03-overdue_circ.t)
authorJason Etheridge <jason@esilibrary.com>
Fri, 7 Nov 2014 18:00:10 +0000 (13:00 -0500)
committerBen Shum <bshum@biblio.org>
Tue, 11 Nov 2014 02:20:15 +0000 (21:20 -0500)
Use safer date math to handle bug with DST

Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/src/perlmods/live_t/03-overdue_circ.t

index 7981d32..fd83b2c 100644 (file)
@@ -145,13 +145,12 @@ if (my $bill_resp = $bill_req->recv) {
     }
 }
 
-my $xact_start = DateTime::Format::ISO8601->parse_datetime(cleanse_ISO8601($circ->xact_start))->epoch;
-my $due_date = DateTime::Format::ISO8601->parse_datetime(cleanse_ISO8601($circ->due_date))->epoch;
-my $twenty_days = OpenSRF::Utils->interval_to_seconds('480 h 0 m 0 s');
+my $xact_start = DateTime::Format::ISO8601->parse_datetime(cleanse_ISO8601($circ->xact_start));
+my $due_date = DateTime::Format::ISO8601->parse_datetime(cleanse_ISO8601($circ->due_date));
 
 # Rewrite history; technically we should rewrite status_changed_item on the copy as well, but, meh...
-$circ->xact_start( $apputils->epoch2ISO8601($xact_start - $twenty_days) );
-$circ->due_date( $apputils->epoch2ISO8601($due_date - $twenty_days) );
+$circ->xact_start( $xact_start->subtract( days => 20 )->iso8601() );
+$circ->due_date( $due_date->subtract( days => 20 )->iso8601() );
 
 $cstore_ses->connect; # need stateful connection
 my $xact = $cstore_ses->request('open-ils.cstore.transaction.begin')->gather(1);