From: Dan Scott Date: Mon, 12 Dec 2016 21:13:00 +0000 (-0500) Subject: LP#1594937 Fix off-by-one display of closed dates X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=fbe2ab5eb683bdc5c6a4ce7cb2c60a8fedb07851;p=evergreen%2Fpines.git LP#1594937 Fix off-by-one display of closed dates The switch to toISOString() to format dates introduced an off-by-one error in the closed dates display, showing one extra day of closure due to the timezone being ignored in toISOString(). toLocaleDateString() is the future of locale-sensitive date formats. In XUL, because it is an old version of Firefox, it lacks locale sensitivity, but for the purposes of the web staff client it's a good base to build on as even Internet Explorer supports the locale and options arguments as of IE 11. And for the immediate purposes of showing the right dates in the closed dates editor, it works. Signed-off-by: Dan Scott Signed-off-by: Chris Sharp --- diff --git a/Open-ILS/xul/staff_client/server/admin/closed_dates.js b/Open-ILS/xul/staff_client/server/admin/closed_dates.js index 732b17ca40..ced15776b1 100644 --- a/Open-ILS/xul/staff_client/server/admin/closed_dates.js +++ b/Open-ILS/xul/staff_client/server/admin/closed_dates.js @@ -174,7 +174,7 @@ function cdDateToHours(date) { function cdDateToDate(date) { var date_obj = new Date(Date.parse(date)); - return date_obj.toISOString().replace(/T.*/,''); // == %F + return date_obj.toLocaleDateString(); }