The OpenD Programming Language

Interval.merge

Returns the union of two intervals

Parameters

interval Interval

The interval to merge with this interval.

Throws

std.datetime.date.DateTimeException if the two intervals do not intersect and are not adjacent or if either interval is empty.

Examples

assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).merge(
            Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) ==
       Interval!Date(Date(1990, 7 , 6), Date(2012, 3, 1)));

assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).merge(
            Interval!Date(Date(2012, 3, 1), Date(2013, 5, 7))) ==
       Interval!Date(Date(1996, 1 , 2), Date(2013, 5, 7)));

Meta