contains method
Checks whether the given date is within this date interval. This requires that the date is not earlier than the start date, and not later than the end date.
date
: The date to check for containment within this interval.
Returns: true
if date
is within this interval; false
otherwise.
ArgumentException
:date
is not in the same calendar as the start and end date of this interval.
Implementation
bool contains(LocalDate date) {
// if (date == null) throw ArgumentError.notNull('date');
Preconditions.checkArgument(date.calendar == start.calendar, 'date', "The date to check must be in the same calendar as the start and end dates");
return start <= date && date <= end;
}