public bool Overlaps(
DateRange value
)
DateRange A | DateRange B | A.Overlaps(B)? |
---|---|---|
Jan 1-Jan 31 | Dec 1-Dec 31 | false |
Jan 1-Jan 31 | Dec 1-Jan 1 | * |
Jan 1-Jan 31 | Dec 15-Jan 15 | true |
Jan 1-Jan 31 | Jan 1-Jan 31 | true |
Jan 1-Jan 31 | Jan 15-Feb 15 | true |
Jan 1-Jan 31 | Jan 31-Feb 28 | * |
Jan 1-Jan 31 | Feb 1-Feb 28 | false |
* The behavior of Overlaps depends on whether the ranges are inclusive. Also, the results of RangeA.Overlaps(RangeB) and RangeB.Overlaps(RangeA) must always return the same value. Therefore, the following shows the behavior of two adjacent ranges. Assume RangeA = { 16:00 - 18:00 } and RangeB = { 18:00 - 20:00 }.
RangeA.IsUpperInclusive | RangeB.IsLowerInclusive | A.Overlaps(B)? |
---|---|---|
true | true | true |
true | false | false |
false | true | false |
false | false | false |
Orthogonal ranges always overlap, regardless of their IsLowerInclusive and IsUpperInclusive values.