[open-ils-commits] r14120 - branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Circ (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Sep 23 12:23:41 EDT 2009
Author: erickson
Date: 2009-09-23 12:23:38 -0400 (Wed, 23 Sep 2009)
New Revision: 14120
Modified:
branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
Log:
represent due date in local time zone (eventually org unit time zone). cleaned up the due-date calculation code
Modified: branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
===================================================================
--- branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm 2009-09-23 16:23:11 UTC (rev 14119)
+++ branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm 2009-09-23 16:23:38 UTC (rev 14120)
@@ -1499,16 +1499,19 @@
sub create_due_date {
my( $self, $duration ) = @_;
+
# if there is a raw time component (e.g. from postgres),
# turn it into an interval that interval_to_seconds can parse
$duration =~ s/(\d{2}):(\d{2}):(\d{2})/$1 h $2 m $3 s/o;
- my ($sec,$min,$hour,$mday,$mon,$year) =
- gmtime(OpenSRF::Utils->interval_to_seconds($duration) + int(time()));
- $year += 1900; $mon += 1;
- my $due_date = sprintf(
- '%s-%0.2d-%0.2dT%0.2d:%0.2d:%0.2d-00',
- $year, $mon, $mday, $hour, $min, $sec);
- return $due_date;
+
+ # for now, use the server timezone. TODO: use workstation org timezone
+ my $due_date = DateTime->now(time_zone => 'local');
+
+ # add the circ duration
+ $due_date->add(seconds => OpenSRF::Utils->interval_to_seconds($duration));
+
+ # return ISO8601 time with timezone
+ return $due_date->strftime('%FT%T%z');
}
More information about the open-ils-commits
mailing list