diff --git a/src/index.js b/src/index.js index 3a4cffff5b3920a9206a280baaa5834e21b6742a..bd327502c89b989ec2128e3e55229f5d3d1f45af 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