DateInterval class
An interval between two dates.
The two dates must be in the same calendar, and the end date must not be earlier than the start date.
The end date is deemed to be part of the range, as this matches many real life uses of date ranges. For example, if someone says "I'm going to be on holiday from Monday to Friday," they usually mean that Friday is part of their holiday.
- Annotations
-
- @immutable
Constructors
- DateInterval(LocalDate start, LocalDate end)
- Constructs a date interval from a start date and an end date, both of which are included in the interval.
Properties
- calendar → CalendarSystem
-
Gets the calendar system of the dates in this interval.
no setter
- end → LocalDate
-
Gets the end date of the interval.
final
- hashCode → int
-
Returns the hash code for this interval, consistent with
Equals(DateInterval)
.no setteroverride - length → int
-
Gets the length of this date interval in days. This will always be at least 1.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- start → LocalDate
-
Gets the start date of the interval.
final
Methods
-
contains(
LocalDate date) → bool - 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.
-
containsInterval(
DateInterval interval) → bool - 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.
-
equals(
DateInterval other) → bool - Compares the given date interval for equality with this one.
-
intersection(
DateInterval interval) → DateInterval? - Returns the intersection between the given interval and this interval.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
Returns a string representation of this interval.
override
-
union(
DateInterval interval) → DateInterval? - Returns the union between the given interval and this interval, as long as they're overlapping or contiguous.
Operators
-
operator ==(
Object rhs) → bool -
Compares two DateInterval values for equality.
override