From: phasefx Date: Thu, 31 Mar 2011 15:17:19 +0000 (+0000) Subject: Logic error trying to merge the date component of one date object with the time compo... X-Git-Url: http://git.equinoxoli.org/?p=evergreen-equinox.git;a=commitdiff_plain;h=a789932ab71a02c3b8e316175c5dc2c1a509cfe8 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. git-svn-id: svn://svn.open-ils.org/ILS/trunk@19917 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/chrome/content/util/timestamp.js b/Open-ILS/xul/staff_client/chrome/content/util/timestamp.js index 0c0a8ab..141551c 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/timestamp.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/timestamp.js @@ -127,13 +127,12 @@ function gen_handle_apply(params) { 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 } ) diff --git a/Open-ILS/xul/staff_client/server/circ/checkout.js b/Open-ILS/xul/staff_client/server/circ/checkout.js index 385e12b..a9319f0 100644 --- a/Open-ILS/xul/staff_client/server/circ/checkout.js +++ b/Open-ILS/xul/staff_client/server/circ/checkout.js @@ -576,11 +576,10 @@ circ.checkout.prototype = { 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); } diff --git a/Open-ILS/xul/staff_client/server/circ/renew.js b/Open-ILS/xul/staff_client/server/circ/renew.js index 6db8455..b0ff2da 100644 --- a/Open-ILS/xul/staff_client/server/circ/renew.js +++ b/Open-ILS/xul/staff_client/server/circ/renew.js @@ -290,12 +290,11 @@ circ.renew.prototype = { 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}'); }