[open-ils-commits] r19919 - in branches/rel_2_0/Open-ILS/xul/staff_client: chrome/content/util server/circ (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Mar 31 11:18:09 EDT 2011


Author: phasefx
Date: 2011-03-31 11:18:06 -0400 (Thu, 31 Mar 2011)
New Revision: 19919

Modified:
   branches/rel_2_0/Open-ILS/xul/staff_client/chrome/content/util/timestamp.js
   branches/rel_2_0/Open-ILS/xul/staff_client/server/circ/checkout.js
   branches/rel_2_0/Open-ILS/xul/staff_client/server/circ/renew.js
Log:
Logic error trying to merge the date component of one date object with the time component of another.  We were trying to use the time object and update it piecemeal, which resulted in non-sensical dates that were forced to wrap.  For example, if the date object was to set to March 31, 2011, and we tried .setMonth(3) on it to change it to April, that would result in an April 31st, which doesn't exist, and the date thus moves forward a certain number of days into May.

This affects Check Out, dedicated Renew interface, and the various date picking functions in Items Out and Holds interfaces.


Modified: branches/rel_2_0/Open-ILS/xul/staff_client/chrome/content/util/timestamp.js
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/chrome/content/util/timestamp.js	2011-03-31 15:17:46 UTC (rev 19918)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/chrome/content/util/timestamp.js	2011-03-31 15:18:06 UTC (rev 19919)
@@ -127,13 +127,12 @@
 
                 var tp_date = tp.dateValue;
                 var dp_date = dp.dateValue;
-                tp_date.setFullYear( dp_date.getFullYear() );
-                tp_date.setMonth( dp_date.getMonth() );
-                tp_date.setDate( dp_date.getDate() );
+                dp_date.setHours( tp_date.getHours() );
+                dp_date.setMinutes( tp_date.getMinutes() );
 
                 update_modal_xulG(
                     {
-                        'timestamp' : util.date.formatted_date(tp_date,'%{iso8601}'),
+                        'timestamp' : util.date.formatted_date(dp_date,'%{iso8601}'),
                         'complete' : 1
                     }
                 )

Modified: branches/rel_2_0/Open-ILS/xul/staff_client/server/circ/checkout.js
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/server/circ/checkout.js	2011-03-31 15:17:46 UTC (rev 19918)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/server/circ/checkout.js	2011-03-31 15:18:06 UTC (rev 19919)
@@ -576,11 +576,10 @@
             var dp = obj.controller.view.checkout_duedate_datepicker;
             var tp_date = tp.dateValue;
             var dp_date = dp.dateValue;
-            tp_date.setFullYear( dp_date.getFullYear() );
-            tp_date.setMonth( dp_date.getMonth() );
-            tp_date.setDate( dp_date.getDate() );
+            dp_date.setHours( tp_date.getHours() );
+            dp_date.setMinutes( tp_date.getMinutes() );
 
-            params.due_date = util.date.formatted_date(tp_date,'%{iso8601}');
+            params.due_date = util.date.formatted_date(dp_date,'%{iso8601}');
         }
 
         if (typeof obj.on_checkout == 'function') { obj.on_checkout(params); }

Modified: branches/rel_2_0/Open-ILS/xul/staff_client/server/circ/renew.js
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/server/circ/renew.js	2011-03-31 15:17:46 UTC (rev 19918)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/server/circ/renew.js	2011-03-31 15:18:06 UTC (rev 19919)
@@ -290,12 +290,11 @@
                 var dp = obj.controller.view.renew_duedate_datepicker;
                 var tp_date = tp.dateValue;
                 var dp_date = dp.dateValue;
-                tp_date.setFullYear( dp_date.getFullYear() );
-                tp_date.setMonth( dp_date.getMonth() );
-                tp_date.setDate( dp_date.getDate() );
+                dp_date.setHours( tp_date.getHours() );
+                dp_date.setMinutes( tp_date.getMinutes() );
 
                 JSAN.use('util.date');
-                params.due_date = util.date.formatted_date(tp_date,'%{iso8601}');
+                params.due_date = util.date.formatted_date(dp_date,'%{iso8601}');
             }
 
 



More information about the open-ils-commits mailing list