isValidDate(in:)
Returns a Boolean value that indicates whether the current combination of properties represents a date which exists in the specified calendar.
Declaration
func isValidDate(in calendar: Calendar) -> BoolParameters
- calendar:
The calendar for which to use in the calculation.
Return Value
true if the date corresponding to the receiver’s values is valid and exists in the given calendar, otherwise false.
Discussion
If the timeZone property is set on the receiver, the time zone property value is used.
This property should not be used for NSDateComponents objects that represent relative quantities of calendar components. To find the the next or previous date that matches a particular set of date components, use the NSCalendar instance method nextDate(after:matching:value:options:) instead.