From 7f96c9d8d008ac6b9ce27a058be51ae8c8d2c098 Mon Sep 17 00:00:00 2001 From: AlexanderKorshunov2020 Date: Wed, 31 Mar 2021 12:43:16 +0500 Subject: [PATCH 1/6] =?UTF-8?q?=D0=9A=D0=BE=D1=80=D1=88=D1=83=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=20=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80?= =?UTF-8?q?=20=D1=82=D0=B0=D1=81=D0=BA=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From ab2cb9e2c0b55af85c1c641b18dde3284c7265af Mon Sep 17 00:00:00 2001 From: AlexanderKorshunov2020 Date: Wed, 31 Mar 2021 12:45:00 +0500 Subject: [PATCH 2/6] =?UTF-8?q?=D0=9A=D0=BE=D1=80=D1=88=D1=83=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=20=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80?= =?UTF-8?q?=20=D1=82=D0=B0=D1=81=D0=BA=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/task_1/index.js | 9 ++++++++- src/task_2/index.js | 11 ++++++++++- src/task_3/index.js | 9 ++++++++- src/task_4/index.js | 5 ++++- 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/task_1/index.js b/src/task_1/index.js index 2abfd00..3b3b332 100644 --- a/src/task_1/index.js +++ b/src/task_1/index.js @@ -15,6 +15,13 @@ @param {number} hours - Час @param {number} minutes - Минуты */ -function Time(hours, minutes) { }; +function Time(hours, minutes) { + if(hours > 23 || hours < 0 || minutes > 60 || minutes < 0) throw new Error('Incorrect time'); + this.hours = hours; + this.minutes = minutes; + this.isEarlier = time => time.timeInMinutes() > this.timeInMinutes(); + this.isLater = time => time.timeInMinutes() < this.timeInMinutes(); + this.timeInMinutes = () => this.minutes + this.hours * 60; +} module.exports.Time = Time; diff --git a/src/task_2/index.js b/src/task_2/index.js index f20d7ee..4c2bdfa 100644 --- a/src/task_2/index.js +++ b/src/task_2/index.js @@ -17,6 +17,15 @@ const { Time } = require('../task_1/index'); @param {Time} startTime - Время начала встречи @param {Time} endTime - Время конца встречи */ -function Meeting(meetingDate, startTime, endTime) { }; +function Meeting(meetingDate, startTime, endTime) { + if(!startTime || !endTime || startTime.timeInMinutes() > endTime.timeInMinutes() || + startTime.timeInMinutes() < 480 || endTime.timeInMinutes() > 1140) throw new Error('Incorrect meeting') + this.meetingDate = meetingDate; + this.startTime = startTime; + this.endTime = endTime; + this.isMeetingInTimeRange = (start, end) => + this.endTime.timeInMinutes() >= start.timeInMinutes() && this.startTime.timeInMinutes() <= end.timeInMinutes() || + this.startTime.timeInMinutes() <= end.timeInMinutes() && this.endTime.timeInMinutes() >= start.timeInMinutes(); +} module.exports.Meeting = Meeting; diff --git a/src/task_3/index.js b/src/task_3/index.js index 4212ffa..021423f 100644 --- a/src/task_3/index.js +++ b/src/task_3/index.js @@ -11,6 +11,13 @@ @param {Date} vacationEndDate - Время конца отпуска */ -function Vacation(vacationStartDate, vacationEndDate) { }; +function Vacation(vacationStartDate, vacationEndDate) { + if(!vacationStartDate || !vacationEndDate || + Number(vacationStartDate) >= Number(vacationEndDate)) throw new Error('Incorrect vacation') + this.vacationStartDate = vacationStartDate; + this.vacationEndDate = vacationEndDate; + this.isDateInVacation = date => + Number(date) >= Number(vacationStartDate) && Number(date) <= Number(vacationEndDate); +} module.exports.Vacation = Vacation; diff --git a/src/task_4/index.js b/src/task_4/index.js index cae825a..0d4d666 100644 --- a/src/task_4/index.js +++ b/src/task_4/index.js @@ -12,6 +12,9 @@ const { Vacation } = require('../task_3/index'); @param {Array} vacations - Массив отпусков */ -function Organaizer(meetings, vacations) { }; +function Organaizer(meetings, vacations) { + this.meetings = meetings; + this.vacations = vacations; + }; module.exports.Organaizer = Organaizer; From f87585e01c2918b90a402517f3c291b269d28ace Mon Sep 17 00:00:00 2001 From: AlexanderKorshunov2020 Date: Wed, 31 Mar 2021 12:49:46 +0500 Subject: [PATCH 3/6] =?UTF-8?q?=D0=9A=D0=BE=D1=80=D1=88=D1=83=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=20=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80?= =?UTF-8?q?=20=D1=82=D0=B0=D1=81=D0=BA=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From ed62c21d9885147ef0ccf0e0b6d89181f9fb22d2 Mon Sep 17 00:00:00 2001 From: AlexanderKorshunov2020 Date: Wed, 31 Mar 2021 12:50:08 +0500 Subject: [PATCH 4/6] =?UTF-8?q?=D0=9A=D0=BE=D1=80=D1=88=D1=83=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=20=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80?= =?UTF-8?q?=20=D1=82=D0=B0=D1=81=D0=BA=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From 6d70f4938ab4b47384334ddd023c1cf7c6e749ca Mon Sep 17 00:00:00 2001 From: AlexanderKorshunov2020 Date: Wed, 31 Mar 2021 13:59:50 +0500 Subject: [PATCH 5/6] =?UTF-8?q?=D0=9A=D0=BE=D1=80=D1=88=D1=83=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=20=D1=82=D0=B0=D1=81=D0=BA=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From 5e3d10f7b8cdf216288f48cb8ef933cf649b81af Mon Sep 17 00:00:00 2001 From: AlexanderKorshunov2020 Date: Wed, 31 Mar 2021 14:01:48 +0500 Subject: [PATCH 6/6] =?UTF-8?q?=D0=9A=D0=BE=D1=80=D1=88=D1=83=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=20=D1=82=D0=B0=D1=81=D0=BA=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit