While looking at #787, I was trying other cases and was curious if I'd get back 2 zero-length intervals, but then got some really unexpected results.
I was expecting to get back 2 zero-length intervals for the beginning and end:
iex(4)> (
Interval.difference(
Interval.new(from: ~N[2025-01-01 12:00:00], until: ~N[2025-01-01 13:00:00], left_open: false, right_open: false),
Interval.new(from: ~N[2025-01-01 12:00:00], until: ~N[2025-01-01 13:00:00], left_open: true, right_open: true)
)
)
[
%Timex.Interval{
from: ~N[2025-01-01 12:00:00],
until: ~N[2025-01-01 13:00:00],
left_open: false,
right_open: false,
step: [days: 1]
}
]
Then I tried just making sure the 2nd arg completely covered the 1st and got this:
iex(5)> (
Interval.difference(
Interval.new(from: ~N[2025-01-01 12:00:00], until: ~N[2025-01-01 13:00:00], left_open: false, right_open: false),
Interval.new(from: ~N[2025-01-01 11:00:00], until: ~N[2025-01-01 14:00:00], left_open: true, right_open: true)
)
)
[
%Timex.Interval{
from: ~N[2025-01-01 12:00:00],
until: ~N[2025-01-01 13:00:00],
left_open: false,
right_open: false,
step: [days: 1]
}
]
While looking at #787, I was trying other cases and was curious if I'd get back 2 zero-length intervals, but then got some really unexpected results.
I was expecting to get back 2 zero-length intervals for the beginning and end:
Then I tried just making sure the 2nd arg completely covered the 1st and got this: