Enumeration

Calendar.SearchDirection

The direction in time to search.

Topics

Enumeration Cases

case backward

Search for a date earlier in time than the start date.

case forward

Search for a date later in time than the start date.

See Also

Calculating Intervals

func dateInterval(of: Calendar.Component, for: Date)

Returns the starting time and duration of a given calendar component that contains a given date.

func dateInterval(of: Calendar.Component, start: inout Date, interval: inout TimeInterval, for: Date)

Returns, via two inout parameters, the starting time and duration of a given calendar component that contains a given date.

func dateIntervalOfWeekend(containing: Date)

Returns a DateInterval of the weekend contained by the given date, or nil if the date is not in a weekend.

func dateIntervalOfWeekend(containing: Date, start: inout Date, interval: inout TimeInterval)

Find the range of the weekend around the given date, returned via two by-reference parameters.

func nextWeekend(startingAfter: Date, direction: Calendar.SearchDirection)

Returns a DateInterval of the next weekend, which starts strictly after the given date.

func nextWeekend(startingAfter: Date, start: inout Date, interval: inout TimeInterval, direction: Calendar.SearchDirection)

Returns the range of the next weekend via two inout parameters. The weekend starts strictly after the given date.