isDate(_:equalTo:toGranularity:)
Returns a Boolean value indicating whether two dates are equal down to the specified component.
Declaration
func isDate(_ date1: Date, equalTo date2: Date, toGranularity component: Calendar.Component) -> BoolParameters
- date1:
A date to compare.
- date2:
A date to compare.
- component:
A granularity to compare. For example, pass
.hourto check if two dates are in the same hour.
Return Value
true if the two dates are equal in the given component and all larger components; otherwise, false.