You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
areIntervalsOverlapping works inconsistently with zero-length intervals.
It returns false as expected, if the interval is very left or very right of another one.
The problem is when the interval is middle of another one, which returns true.
I think this is expected. Your interval from 1 to 1 is inside of the other interval from 0 to 10 so areIntervalsOverlapping correctly returns true. The edges only return false since the third option (inclusive is not turned on). If you turn it on where it considers intervals adjacent to each other as overlapping it will return correctly true:
console.log(areIntervalsOverlapping({start: 0,end: 10},{start: 10,end: 10}));// false - intervals not overlappingconsole.log(areIntervalsOverlapping({start: 0,end: 10},{start: 10,end: 10},{inclusive: true}));// true - intervals not overlapping but adjacent to each other
The problem
areIntervalsOverlapping
works inconsistently with zero-length intervals.It returns
false
as expected, if the interval is very left or very right of another one.The problem is when the interval is middle of another one, which returns
true
.Demo
Expected Behavior
all cases return
false
Debug Information
The text was updated successfully, but these errors were encountered: