CPCDateInterval

public protocol CPCDateInterval : RangeExpression where Self.Bound == Date

Common protocol for types representing an arbitrary range of dates.

  • Earliest date that is included in date interval.

    Declaration

    Swift

    var start: Date { get }
  • end

    Earliest date that is not included in date interval and is later than start (analogous to Range <Date>.upperBound).

    Declaration

    Swift

    var end: Date { get }
  • duration Default implementation

    Duration of date interval. Default implementation returns self.end.timeIntervalSince (self.start).

    Default Implementation

    Declaration

    Swift

    var duration: TimeInterval { get }
  • contains(_:) Default implementation

    Returns a Boolean value indicating whether this date interval is fully contained or is equal to the given range.

    Default Implementation

    Undocumented

    Undocumented

    Undocumented

    Declaration

    Swift

    func contains<R>(_ dateInterval: R) -> Bool where R : RangeExpression, R.Bound == Date

    Parameters

    dateInterval

    An interval to check.

    Return Value

    true if dateInterval is contained in this one; otherwise, false.

  • Returns a Boolean value indicating whether this date interval is fully contained or is equal to the given range.

    Declaration

    Swift

    func contains<R>(_ dateInterval: R) -> Bool where R : CPCDateInterval

    Parameters

    dateInterval

    An interval to check.

    Return Value

    true if dateInterval is contained in this one; otherwise, false.

  • relative(to:) Extension method

    Declaration

    Swift

    public func relative<C>(to collection: C) -> Range<Date> where C : Collection, C.Index == Date
  • prev Extension method

    Previous interval (an interval that has the same duration and ends when this interval starts).

    Declaration

    Swift

    public var prev: Self { get }
  • next Extension method

    Next interval (an interval that has the same duration and starts when this interval ends).

    Declaration

    Swift

    public var next: Self { get }