This commit is contained in:
parent
06c67636d3
commit
892e267a16
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue