Calendar

public extension Calendar
  • A cached gregorian calendar.

    The calendar’s locale and timeZone are set to testableCurrent to prevent flaky tests.

    Declaration

    Swift

    static let gregorian: Calendar
  • Returns the current calendar, except in test mode where gregorian is returned instead to prevent flaky tests.

    Relies on ProcessInfo.isRunningInTestMode to determine if the code is running in test mode or not.

    Declaration

    Swift

    static var testableCurrent: Calendar { get }
  • A cached iso8601 calendar.

    The calendar’s locale and timeZone are set to testableCurrent to prevent flaky tests.

    Declaration

    Swift

    static let iso8601: Calendar