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
Describe the bug Interval.intersection() on abutting intervals returns a 0-length interval, in spite of https://moment.github.io/luxon/docs/class/src/interval.js~Interval.html#static-method-fromDateTimes saying that Interval is "Inclusive of the start but not the end". The docstring for intersection also says explicitly "Returns null if the intersection is empty, meaning, the intervals don't intersect."
To Reproduce
test('intersection of abutting intervals is null', () => {
expect(
Interval.fromISO('2021-01-01T09:00:00Z/2021-01-01T10:00:00Z').intersection(
Interval.fromISO('2021-01-01T10:00:00Z/2021-01-01T11:00:00Z'),
),
).toBeNull();
});
Actual vs Expected behavior
If Interval is indeed meant to be inclusive of the start but not the end, then the overlap should be null. Instead I get for the test above:
Describe the bug
Interval.intersection()
on abutting intervals returns a 0-length interval, in spite of https://moment.github.io/luxon/docs/class/src/interval.js~Interval.html#static-method-fromDateTimes saying thatInterval
is "Inclusive of the start but not the end". The docstring for intersection also says explicitly "Returns null if the intersection is empty, meaning, the intervals don't intersect."To Reproduce
Actual vs Expected behavior
If
Interval
is indeed meant to be inclusive of the start but not the end, then the overlap should be null. Instead I get for the test above:It's worth noting that
Interval.overlaps()
works as expected, with the following test passing:Conceptually, I think that
Interval.overlaps()
should be perform identically toInterval.intersection() != null
.Desktop (please complete the following information):
^1.26.0
The text was updated successfully, but these errors were encountered: