Bug Description
ConflictDetector._isWithinBusinessHours() (lines 507-516 in core/conflicts/ConflictDetector.js) has fundamentally broken logic:
_isWithinBusinessHours(start, end, options) {
const startHour = start.getHours();
const endHour = end.getHours();
const businessStart = parseInt(options.businessHours.start.split(':')[0]);
const businessEnd = parseInt(options.businessHours.end.split(':')[0]);
return startHour >= businessStart && endHour <= businessEnd;
}
Problems:
-
Ignores minutes: A gap starting at 8:45 AM with business hours 9:00-17:00 would pass (8 >= 9 is false, so it's rejected even though part of the gap is valid). Conversely, 9:59 is treated the same as 9:00.
-
Doesn't handle multi-day spans: If start and end are on different days, the hour comparison is meaningless.
-
endHour boundary: An event ending at exactly 17:00 has endHour = 17, so 17 <= 17 passes. But 17:01 has endHour = 17 too, which also passes — the minutes are lost.
-
Weekend handling: The excludeWeekends option from getFreePeriods() is passed through but never checked here.
Impact
getFreePeriods() returns incorrect free time slots when businessHoursOnly: true is used, making the scheduling assistant unreliable.
Files
core/conflicts/ConflictDetector.js:507-516
- Called from
getFreePeriods() at lines 188-189 and 205
Bug Description
ConflictDetector._isWithinBusinessHours()(lines 507-516 incore/conflicts/ConflictDetector.js) has fundamentally broken logic:Problems:
Ignores minutes: A gap starting at 8:45 AM with business hours 9:00-17:00 would pass (
8 >= 9is false, so it's rejected even though part of the gap is valid). Conversely, 9:59 is treated the same as 9:00.Doesn't handle multi-day spans: If start and end are on different days, the hour comparison is meaningless.
endHour boundary: An event ending at exactly 17:00 has
endHour = 17, so17 <= 17passes. But 17:01 hasendHour = 17too, which also passes — the minutes are lost.Weekend handling: The
excludeWeekendsoption fromgetFreePeriods()is passed through but never checked here.Impact
getFreePeriods()returns incorrect free time slots whenbusinessHoursOnly: trueis used, making the scheduling assistant unreliable.Files
core/conflicts/ConflictDetector.js:507-516getFreePeriods()at lines 188-189 and 205