Day

public struct Day : Codable, Hashable

Opening hours on a particular day of the week (with a special case for public holidays).

  • day

    Declaration

    Swift

    public let day: DayOfWeek
  • Declaration

    Swift

    public let times: [Time]
  • Declaration

    Swift

    public init(day: DayOfWeek, times: [Time])
  • Declaration

    Swift

    public struct Time : Codable, Hashable
  • Declaration

    Swift

    public enum DayOfWeek : String, Codable
  • Checks if provided date is covered by this particular day

    Warning

    This does not cover public holidays. If this object represents a public holiday, the return value is always false.

    Declaration

    Swift

    public func contains(_ date: Date, in timeZone: TimeZone) -> Bool

    Parameters

    date

    Date to check

    timeZone

    Time zone of the date object

    Return Value

    If date is covered by this particular day.

  • Checks if opening hour specify that the provided that is open.

    Warning

    This does not cover public holidays. If date is on a public holiday, the day of the week will be used.

    Declaration

    Swift

    public func isOpen(at date: Date, in timeZone: TimeZone) -> Bool

    Parameters

    date

    Date to check

    Return Value

    Whether open on provided date