Merge branch 'master' into dev
gitea/salix/dev There was a failure building this commit Details

This commit is contained in:
Joan Sanchez 2019-04-03 11:55:18 +02:00
commit e433828f7c
1 changed files with 3 additions and 3 deletions

View File

@ -124,7 +124,7 @@ module.exports = Self => {
let totalHolidays = contract.holidays().days; let totalHolidays = contract.holidays().days;
if (contract.started && contract.ended) if (contract.started && contract.ended)
totalHolidays = getHolidaysByContract(contract); totalHolidays = getHolidaysByContract(started, contract);
calendar.totalHolidays += totalHolidays; calendar.totalHolidays += totalHolidays;
@ -141,10 +141,10 @@ module.exports = Self => {
return [calendar, absences, holidays]; return [calendar, absences, holidays];
}; };
function getHolidaysByContract(contract) { function getHolidaysByContract(started, contract) {
const dayTimestamp = 1000 * 60 * 60 * 24; const dayTimestamp = 1000 * 60 * 60 * 24;
const endedTime = contract.ended.getTime(); const endedTime = contract.ended.getTime();
const startedTime = contract.started.getTime(); const startedTime = started.getTime();
const contractDays = Math.floor((endedTime - startedTime) / dayTimestamp); const contractDays = Math.floor((endedTime - startedTime) / dayTimestamp);
if (contractDays < 365) if (contractDays < 365)