From 4433b1413ad44496da33143b6a4efd8de97bfc20 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 16 Nov 2016 16:52:22 -0500 Subject: [PATCH] JBAS-1377 date.getYMD() avoids clobbering date Signed-off-by: Bill Erickson --- Open-ILS/web/js/dojo/openils/Util.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- 2.11.0