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: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=a789932ab71a02c3b8e316175c5dc2c1a509cfe8;p=evergreen%2Fequinox.git 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 0c0a8ab7d6..141551cd8a 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 385e12b832..a9319f0293 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 6db84555d7..b0ff2dabb4 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}'); }