diff --git a/src/index.js b/src/index.js index 8240c81eb8cf73c14932fd5310e9b8e9dd44d3ea..ef68af9a493db7cfa9ccef40ce8b9db57e3859b8 100755 --- a/src/index.js +++ b/src/index.js @@ -15,9 +15,12 @@ require('moment-timezone') moment.locale('fr') // set the language moment.tz.setDefault('Europe/Paris') // set the timezone -const startDate = moment() - .subtract(1, 'year') - .format('YYYY-MM-DD') +const manualExecution = + process.env.COZY_JOB_MANUAL_EXECUTION === 'true' ? true : false +const startDate = manualExecution + ? moment().subtract(1, 'year').format('YYYY-MM-DD') + : moment().subtract(3, 'year').format('YYYY-MM-DD') + const endDate = moment() .startOf('day') .subtract(1, 'day')