Skip to content
Snippets Groups Projects
Commit aea148b5 authored by i-vall's avatar i-vall
Browse files

fix: adapted time format to fr locale

parent 88f62e82
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,7 @@ const { ...@@ -9,6 +9,7 @@ const {
const rp = require('request-promise') const rp = require('request-promise')
const moment = require('moment') const moment = require('moment')
const cookiejar = rp.jar() const cookiejar = rp.jar()
moment.locale('fr')
//require('request-debug')(rp) //require('request-debug')(rp)
...@@ -35,7 +36,6 @@ const startDate = moment() ...@@ -35,7 +36,6 @@ const startDate = moment()
.format('DD/MM/YYYY') .format('DD/MM/YYYY')
const endDate = moment().format('DD/MM/YYYY') const endDate = moment().format('DD/MM/YYYY')
function authenticate(login, password) { function authenticate(login, password) {
const authRequest = { const authRequest = {
method: 'POST', method: 'POST',
...@@ -45,7 +45,12 @@ function authenticate(login, password) { ...@@ -45,7 +45,12 @@ function authenticate(login, password) {
Host: 'espace-client-connexion.enedis.fr', Host: 'espace-client-connexion.enedis.fr',
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded'
}, },
body: 'IDToken1='+encodeURI(login)+'&IDToken2='+encodeURI(password)+'&goto=aHR0cHM6Ly9lc3BhY2UtY2xpZW50LXBhcnRpY3VsaWVycy5lbmVkaXMuZnIvZ3JvdXAvZXNwYWNlLXBhcnRpY3VsaWVycy9hY2N1ZWls&gotoOnFail=&SunQueryParamsString=cmVhbG09cGFydGljdWxpZXJz&encoded=true&gx_charset=UTF-8', body:
'IDToken1=' +
encodeURI(login) +
'&IDToken2=' +
encodeURI(password) +
'&goto=aHR0cHM6Ly9lc3BhY2UtY2xpZW50LXBhcnRpY3VsaWVycy5lbmVkaXMuZnIvZ3JvdXAvZXNwYWNlLXBhcnRpY3VsaWVycy9hY2N1ZWls&gotoOnFail=&SunQueryParamsString=cmVhbG09cGFydGljdWxpZXJz&encoded=true&gx_charset=UTF-8',
followAllRedirects: true followAllRedirects: true
} }
...@@ -79,10 +84,7 @@ async function getData() { ...@@ -79,10 +84,7 @@ async function getData() {
const loadProfile = response.graphe.data.map(value => { const loadProfile = response.graphe.data.map(value => {
return { return {
load: value.valeur, load: value.valeur,
time: moment time: moment(start, 'DD/MM/YYYY')
.utc(start, 'DD/MM/YYYY')
.add(-1, 'hour')
.utcOffset(1)
.add((value.ordre - 1) * 0.5, 'hour') .add((value.ordre - 1) * 0.5, 'hour')
.format() .format()
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment