Instance Method

isDate(_:equalTo:toGranularity:)

Compares the given dates down to the given component, reporting them equal if they are the same in the given component and all larger components.

Declaration

func isDate(_ date1: Date, equalTo date2: Date, toGranularity component: Calendar.Component) -> Bool

Parameters

date1

A date to compare.

date2

A date to compare.

component

A granularity to compare. For example, pass .hour to check if two dates are in the same hour.

Return Value

true if the given date is within tomorrow.