intersection method

Timespan intersection(
  1. Timespan other
)

Implementation

Timespan intersection(Timespan other) =>
    end.isBefore(other.begin) || other.end.isBefore(begin)
        ? Timespan(duration: Duration.zero)
        : Timespan(
            begin: begin.isAfter(other.begin) ? begin : other.begin,
            end: end.isBefore(other.end) ? end : other.end);