PastPeriodFromNow
public struct PastPeriodFromNow : Hashable, Codable
Represents a period from point in the past to now, defined in days,weeks, months or years.
-
Calendar components for constructing a period.
See moreDeclaration
Swift
public enum CalendarUnit : String, Hashable, Codable -
Returns a calendar unit of the period.
Declaration
Swift
public let unit: CalendarUnit -
Returns number of calendar units in the period.
Declaration
Swift
public let value: Int -
Returns a period from one
unitcomponent in the past to now.Declaration
Swift
public static func past(_ unit: CalendarUnit) -> PastPeriodFromNowParameters
unitCalendar unit of desired period.
-
Returns a period from
value * unitcomponents in the past to now.Even though there is no formal precondition for the upper limmit of
value, providing an extremely large number may result in a crash. That can, however, only happen by a programming mistake, as the only meaningful values are those that result in period’s start date not lower than 14 August 1991, the date when arXiv.org was launched.Precondition
value > 0Declaration
Swift
public static func past(_ value: Int, unit: CalendarUnit) -> PastPeriodFromNowParameters
valueNumber calendar units in desired period.
unitCalendar unit of desired period.
-
Returns a date interval representation of the period.
Declaration
Swift
public var dateInterval: DateInterval { get }
PastPeriodFromNow Structure Reference