From c70e13b40ab7793e9fea465992a2b335e77ff33d Mon Sep 17 00:00:00 2001 From: Codex <liarikhalid@gmail.com> Date: Tue, 21 Jan 2020 17:06:04 +0100 Subject: [PATCH] Changing the time format on the persisted Data --- src/index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 3a4cfff..bd32750 100644 --- a/src/index.js +++ b/src/index.js @@ -108,10 +108,18 @@ async function getData(response, baseUrl, apiAuthKey) { function format(response) { const data = response.resultatRetour.slice(1).map((value, index) => { + + const time = moment(value.DateReleve, moment.ISO_8601).format('YYYY-MM-DD'); + return { - time: moment(value.DateReleve, moment.ISO_8601).format('YYYY-MM-DD'), + load: value.ValeurIndex - response.resultatRetour[index].ValeurIndex, - type: value.TypeAgregat + year: parseInt(time.format('YYYY')), + month: parseInt(time.format('M')), + day: parseInt(time.format('D')), + hour: 0, + minute: 0 + //,type: value.TypeAgregat } }) return data -- GitLab