diff --git a/package.json b/package.json index 2ed177f1ada785c9feed9ed9d4e2eed0998c6309..fbecae7a14312e60c13d97dd82289bbaa536eede 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,8 @@ }, "dependencies": { "cozy-konnector-libs": "4.15.7", - "moment": "^2.24.0" + "moment": "^2.24.0", + "moment-timezone": "^0.5.26" }, "devDependencies": { "copy-webpack-plugin": "5.0.3", diff --git a/src/index.js b/src/index.js index 2c461ae7b55aaa27d447ab3d6a3f78f381cf162f..3a4cffff5b3920a9206a280baaa5834e21b6742a 100644 --- a/src/index.js +++ b/src/index.js @@ -8,8 +8,15 @@ const { } = require('cozy-konnector-libs') const rp = require('request-promise') const moment = require('moment') -//const moment = require('moment') -//require('request-debug')(rp) +require('moment-timezone') + +moment.locale('fr') // set the language +moment.tz.setDefault('Europe/Paris') // set the timezone + +const startDate = moment() + .subtract(10, 'day') + .format('MM/DD/YYYY') +const endDate = moment().format('MM/DD/YYYY') module.exports = new BaseKonnector(start) @@ -77,8 +84,8 @@ async function getData(response, baseUrl, apiAuthKey) { form: { token: response.resultatRetour.token, num_abt: response.resultatRetour.num_abt, - date_debut: '01/01/2019', - date_fin: '01/10/2019' + date_debut: startDate, + date_fin: endDate }, json: true } diff --git a/yarn.lock b/yarn.lock index 0e81fdc69746dca0afb1a4dfa59f47495abe379f..290ead48b0889007faa8b1aa95e5912f219b009f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3570,7 +3570,14 @@ mkdirp@0.5.1, mkdirp@0.x.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@ dependencies: minimist "0.0.8" -moment@^2.24.0: +moment-timezone@^0.5.26: + version "0.5.26" + resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.26.tgz#c0267ca09ae84631aa3dc33f65bedbe6e8e0d772" + integrity sha512-sFP4cgEKTCymBBKgoxZjYzlSovC20Y6J7y3nanDc5RoBIXKlZhoYwBoZGe3flwU6A372AcRwScH8KiwV6zjy1g== + dependencies: + moment ">= 2.9.0" + +"moment@>= 2.9.0", moment@^2.24.0: version "2.24.0" resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b" integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==