Signed-off-by: Bill Erickson <berickxx@gmail.com>
// 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