date(_:matchesComponents:)
Returns whether a given date matches all of the given date components.
Declaration
func date(_ date: Date, matchesComponents components: DateComponents) -> BoolParameters
- date:
The date for which to perform the calculation.
- components:
The date components to match.
Return Value
true if the given date matches the given components, otherwise false.
Discussion
This method is useful for determining whether dates calculated by methods like nextDate(after:matching:value:options:) or enumerateDates(startingAfter:matching:options:using:) are exact, or required an adjustment due to a nonexistent time.