Date change now works first time for changing a single day.

This commit is contained in:
Clinton Alexander 2016-07-11 10:19:40 +01:00
parent 914e6cf52c
commit 89e8708e76
2 changed files with 4 additions and 3 deletions

View File

@ -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) {

View File

@ -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;
}