diff --git a/__tests__/__renderer__/classes/Calendar.js b/__tests__/__renderer__/classes/Calendar.js index 49c582de7..a6d53fe6c 100644 --- a/__tests__/__renderer__/classes/Calendar.js +++ b/__tests__/__renderer__/classes/Calendar.js @@ -186,8 +186,8 @@ describe('Calendar class Tests', () => { expect(calendar._hasInputError('', '', '23:00', '00:00')).toBeTruthy(); // TODO: Fix commented // expect(calendar._hasInputError('not-valid-hour', '', '', 'not-valid-hour')).toBeTruthy(); - //expect(calendar._hasInputError('00:00', '12:00', '', '20:00')).not.toBeTruthy(); - //expect(calendar._hasInputError('00:00', '', '13:00', '20:00')).not.toBeTruthy(); + expect(calendar._hasInputError('00:00', '12:00', '', '20:00')).toBeTruthy(); + expect(calendar._hasInputError('00:00', '', '13:00', '20:00')).toBeTruthy(); }); }); diff --git a/js/classes/Calendar.js b/js/classes/Calendar.js index 56cff21d3..65682151f 100644 --- a/js/classes/Calendar.js +++ b/js/classes/Calendar.js @@ -853,16 +853,21 @@ class Calendar { */ _hasInputError(dayBegin, lunchBegin, lunchEnd, dayEnd) { var dayValues = new Array(); - if (validateTime(dayBegin)) { + var bDuringLunch = false; + if (validateTime(dayBegin)) { dayValues.push(dayBegin); } if (validateTime(lunchBegin)) { + bDuringLunch = true; dayValues.push(lunchBegin); } if (validateTime(lunchEnd)) { + if (!bDuringLunch) return true; + bDuringLunch = false; dayValues.push(lunchEnd); } if (validateTime(dayEnd)) { + if (bDuringLunch) return true; dayValues.push(dayEnd); } for (var index = 0; index < dayValues.length; index++) {