ISO8601
ISO8601 copied to clipboard
Add time interval `#union`
Add TimeInterval#union
to merge two intervals. And consider if they need to intersect or not. If not, the behaviour could be unexpected (?)
Some more thoughts on treating a TimeInterval
like an ordered set:
Let's define the empty interval properties first:
- An empty interval has length 0.
- If A and B are empty intervals, A == B.
-
start_time == end_time
if true for an empty interval.
Questions:
- What are the values of
start_time
andend_time
? - What is the ISO8601 representation of an empty interval,
PT0S
(notice the lack of time point)?
If we define an empty set as:
- An empty interval has length 0,
start_time == end_time == 0
. - A(st_a, et_a) != B(st_b, et_b) if (st_a, et_a) != (st_b, et_b)
Then the result of an empty intersection is not possible to represent, unless we do something like creating an empty interval based on the start_time
of the initial interval, so an arbitrary decision.
Maybe the solution is to go away from known concepts and try to use something like #blend
instead of #union
. So a A(st_a, et_a) blend B(st_b, et_b)
operation where st_a < st_b
and et_a < et_b
would result on C(st_c, et_c)
where st_c = st_a
and et_c = st_b
.
So the resulting interval would contain new time points if A and B have no intersection.