intersectionOf static method
Returns the intersection of DateRanges a and b.
If a does not overlap with b, this factory returns null. Note
that this is distinct from a DateRange with start == end == null,
which represents a DateRange that is unbounded in both directions.
Implementation
static DateRange? intersectionOf(DateRange a, DateRange b) {
final start = _laterStartDateOf(a.start, b.start);
final end = _earlierEndDateOf(a.end, b.end);
if (start != null && end != null && start > end) return null;
return DateRange(start, end);
}