inBetween static method
Returns the period between first
and second
.
If first
and second
overlap, null
will be returned.
If first
and second
do not overlap, the period between them will be
returned.
If first
occurs before second
, the period will be from the end of the
first
period to the start of the second
period.
If first
occurs after second
, the period will be from the end of the
second
period to the start of the first
period.
Implementation
static Period? inBetween(Period first, Period second) {
if (first.overlapsWith(second)) return null;
if (first.occursBefore(second)) {
return Period(start: first.end, end: second.start);
}
return Period(start: second.end, end: first.start);
}