diff --git a/src/main/webdemo/js/app.js b/src/main/webdemo/js/app.js index 74152df6e1..e716480816 100644 --- a/src/main/webdemo/js/app.js +++ b/src/main/webdemo/js/app.js @@ -2,7 +2,9 @@ function formatDateForNode(date) { // Produces yyyy-dd-mm. JS is missing proper date formatting libs - return date.toISOString().substring(0, 10); + let day = ("0" + (date.getDate())).slice(-2); + let month = ("0" + (date.getMonth() + 1)).slice(-2); + return `${date.getFullYear()}-${month}-${day}`; } function formatDateForAngular(dateStr) { diff --git a/src/main/webdemo/js/services/NodeApi.js b/src/main/webdemo/js/services/NodeApi.js index ee4335fd94..a11de4a2ce 100644 --- a/src/main/webdemo/js/services/NodeApi.js +++ b/src/main/webdemo/js/services/NodeApi.js @@ -45,8 +45,7 @@ define(['angular', 'lodash'], (angular, _) => { break; case "day": - // +2 because date is 0 based in JS dates but 1 based in the API - newDate.setDate(date.getDate() + 2); + newDate.setDate(date.getDate() + 1); break; }