DateRange
public struct DateRange : Codable
Undocumented
-
An (optional) display name for the range.
Declaration
Swift
public var name: String?
-
The low end timestamp in this range. A unix timestamp in milliseconds.
Declaration
Swift
public var floor: Milliseconds
-
The high end timestamp in this range. A unix timestamp in milliseconds.
Declaration
Swift
public var ceiling: Milliseconds
-
The timezone used as the basis of the timestamps this date range.
Declaration
Swift
public var timeZone: TimeZone
-
The default calendar used in generating
DateRange
instances. This defaults toCalendar.autoupdatingCurrent
, and is used both for default timezones as well as generating ranges based on calendar components viaDateRange.init(name:component:value:starting:)
.Declaration
Swift
public static var calendar: Calendar
-
Creates a date range with the given values.
Declaration
Swift
public init(name: String? = nil, floor: Milliseconds, ceiling: Milliseconds, timeZone: TimeZone = DateRange.calendar.timeZone)
Parameters
name
An (optional) display name for the range.
floor
The lowest timestamp covered by the range.
ceiling
The highest timestamp covered by the range.
timeZone
The timezone used as the basis of the timestamps this date range.
-
Undocumented
Declaration
Swift
public init(name: String? = nil, floor: MillisecondsRepresentable, ceiling: MillisecondsRepresentable, timeZone: TimeZone = DateRange.calendar.timeZone)
-
Creates a date range that covers a period defined by
component
multiplied byvalue
, starting from the givenstarting
unix timestamp.Declaration
Swift
public init?(name: String? = nil, component: Calendar.Component, value: Int, starting: Milliseconds = .now)
Parameters
name
An (optional) display name for the range.
component
A single component to add.
value
The number of the specified
component
to add.starting
A unix timestamp in milliseconds to use as the starting point for generating the date range. Defaults to
Milliseconds.now
. -
Creates a date range that covers a period defined by
component
multiplied byvalue
, starting from the givenstarting
unix timestamp.Declaration
Swift
public init?(name: String? = nil, component: Calendar.Component, value: Int, starting: MillisecondsRepresentable)
Parameters
name
An (optional) display name for the range.
component
A single component to add.
value
The number of the specified
component
to add.starting
A unix timestamp in milliseconds to use as the starting point for generating the date range.
-
Declaration
Swift
public init(from decoder: Decoder) throws
-
Declaration
Swift
public func encode(to encoder: Encoder) throws