From: Bill Erickson Date: Wed, 16 Nov 2016 21:52:22 +0000 (-0500) Subject: JBAS-1377 date.getYMD() avoids clobbering date X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=4433b1413ad44496da33143b6a4efd8de97bfc20;p=working%2FEvergreen.git JBAS-1377 date.getYMD() avoids clobbering date Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/web/js/dojo/openils/Util.js b/Open-ILS/web/js/dojo/openils/Util.js index 3482fb673e..1696764ab2 100644 --- a/Open-ILS/web/js/dojo/openils/Util.js +++ b/Open-ILS/web/js/dojo/openils/Util.js @@ -515,7 +515,12 @@ if(!dojo._hasResource["openils.Util"]) { // Returns the provided date as YYYY-MM-DD for the local time zone. // If no date is provided, the current date is used. openils.Util.getYMD= function(d) { - if (!d) d = new Date(); + if (d) { + // avoid clobbering (below) the date object passed by the caller. + d = new Date(d.getTime()); + } else { + d = new Date(); + } // toISOString returns a UTC date. Mangle our 'now' date to // force its UTC verion to match that of the local version