DateInterval constructor

DateInterval(
  1. LocalDate start,
  2. LocalDate end
)

Constructs a date interval from a start date and an end date, both of which are included in the interval.

  • start: Start date of the interval
  • end: End date of the interval

Returns: A date interval between the specified dates.

Implementation

DateInterval(this.start, this.end) {
  // todo: will this equivalence work out?
  Preconditions.checkArgument(start.calendar == end.calendar, 'end', "Calendars of start and end dates must be the same.");
  Preconditions.checkArgument(!(end < start), 'end', "End date must not be earlier than the start date");
}