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
DateRangeinstances. 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
nameAn (optional) display name for the range.
floorThe lowest timestamp covered by the range.
ceilingThe highest timestamp covered by the range.
timeZoneThe 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
componentmultiplied byvalue, starting from the givenstartingunix timestamp.Declaration
Swift
public init?(name: String? = nil, component: Calendar.Component, value: Int, starting: Milliseconds = .now)Parameters
nameAn (optional) display name for the range.
componentA single component to add.
valueThe number of the specified
componentto add.startingA 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
componentmultiplied byvalue, starting from the givenstartingunix timestamp.Declaration
Swift
public init?(name: String? = nil, component: Calendar.Component, value: Int, starting: MillisecondsRepresentable)Parameters
nameAn (optional) display name for the range.
componentA single component to add.
valueThe number of the specified
componentto add.startingA 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
View on GitHub
DateRange Structure Reference