diff --git a/modules/worker/back/methods/worker-calendar/absences.js b/modules/worker/back/methods/worker-calendar/absences.js index 9b9479ca1..1ca212863 100644 --- a/modules/worker/back/methods/worker-calendar/absences.js +++ b/modules/worker/back/methods/worker-calendar/absences.js @@ -124,7 +124,7 @@ module.exports = Self => { let totalHolidays = contract.holidays().days; if (contract.started && contract.ended) - totalHolidays = getHolidaysByContract(contract); + totalHolidays = getHolidaysByContract(started, contract); calendar.totalHolidays += totalHolidays; @@ -141,10 +141,10 @@ module.exports = Self => { return [calendar, absences, holidays]; }; - function getHolidaysByContract(contract) { + function getHolidaysByContract(started, contract) { const dayTimestamp = 1000 * 60 * 60 * 24; const endedTime = contract.ended.getTime(); - const startedTime = contract.started.getTime(); + const startedTime = started.getTime(); const contractDays = Math.floor((endedTime - startedTime) / dayTimestamp); if (contractDays < 365)