Skip to content

Commit

Permalink
Merge pull request #5 from OlgaGulyakevich/module5-task2
Browse files Browse the repository at this point in the history
  • Loading branch information
keksobot authored Dec 4, 2024
2 parents ba87e77 + 13f8d83 commit d37b118
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions js/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,23 @@ const extractDigits = (inputChar) => {
}
return digits ? Math.abs(parseInt(digits, 10)) : NaN;
};

// Функция для проверки, укладывается ли встреча в рамки рабочего дня.

function isMeetingWithinWorkHours (workStart, workEnd, meetingStart, meetingDuration) {

Check failure on line 35 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

'isMeetingWithinWorkHours' is defined but never used

const timeToMinutes = (time) => {
const [hours, minutes] = time.split(':').map(Number);
return hours * 60 + minutes;
};

const workStartMinutes = timeToMinutes(workStart);
const workEndMinutes = timeToMinutes(workEnd);
const meetingStartMinutes = timeToMinutes(meetingStart);
const meetingEndMinutes = meetingStartMinutes + meetingDuration;

return (
meetingStartMinutes >= workStartMinutes &&
meetingEndMinutes <= workEndMinutes
);
}

0 comments on commit d37b118

Please sign in to comment.