dateIntervalOfWeekend(containing:)

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

iOS
10.0+
macOS
10.12+
tvOS
10.0+
watchOS
3.0+
func dateIntervalOfWeekend(containing date: Date) -> DateInterval?

Parameters

date

The date contained in the weekend.

Returns

A DateInterval, or nil if the date is not in a weekend.