containsInterval method

bool containsInterval(
  1. DateInterval interval
)

Checks whether the given interval is within this interval. This requires that the start date of the specified interval is not earlier than the start date of this interval, and the end date of the specified interval is not later than the end date of this interval.

An interval contains another interval with same start and end dates, or itself.

  • interval: The interval to check for containment within this interval.

Returns: true if interval is within this interval; false otherwise.

ArgumentException: interval uses a different calendar to this date interval.

Implementation

bool containsInterval(DateInterval interval) {
  _validateInterval(interval);
  return contains(interval.start) && contains(interval.end);
}