Instance Method

range(ofWeekendStart:interval:containing:)

Returns whether a given date falls within a weekend period, and if so, returns by reference the start date and time interval of the weekend range.

Declaration

func range(ofWeekendStart datep: AutoreleasingUnsafeMutablePointer<NSDate?>?, interval tip: UnsafeMutablePointer<TimeInterval>?, containing date: Date) -> Bool

Parameters

datep

Upon return, contains the starting date of the next weekend period.

tip

Upon return, contains the time interval of the next weekend period.

date

The date to use to perform the calculation.

Return Value

true if the given date falls within a weekend period, otherwise false.

Discussion

Note that a particular calendar day may not necessarily fall entirely within a weekend period, as weekends can start in the middle of a day in some calendars and locales.

See Also

Getting Calendar Information

var calendarIdentifier: NSCalendar.Identifier

A string representing a calendar identity.

var firstWeekday: Int

The index of the first weekday of the receiver.

var locale: Locale?

The locale of the receiver.

func maximumRange(of: NSCalendar.Unit)

Returns the maximum range limits of the values that a given unit can take on.

func minimumRange(of: NSCalendar.Unit)

Returns the minimum range limits of the values that a given unit can take on.

var minimumDaysInFirstWeek: Int

The minimum number of days in the first week of the receiver.

func ordinality(of: NSCalendar.Unit, in: NSCalendar.Unit, for: Date)

Returns, for a given absolute time, the ordinal number of a smaller calendar unit (such as a day) within a specified larger calendar unit (such as a week).

func range(of: NSCalendar.Unit, in: NSCalendar.Unit, for: Date)

Returns the range of absolute time values that a smaller calendar unit (such as a day) can take on in a larger calendar unit (such as a month) that includes a specified absolute time.

func range(of: NSCalendar.Unit, start: AutoreleasingUnsafeMutablePointer<NSDate?>?, interval: UnsafeMutablePointer<TimeInterval>?, for: Date)

Returns by reference the starting time and duration of a given calendar unit that contains a given date.

var timeZone: TimeZone

The time zone for the receiver.

struct NSCalendar.Unit

Calendrical units such as year, month, day and hour.