StructureFoundation5.9.0
DateInterval
DateInterval represents a closed date interval in the form of [startDate, endDate]. It is possible for the start and end dates to be the same with a duration of 0. DateInterval does not support reverse intervals i.e. intervals where the duration is less than 0 and the end date occurs earlier in time than the start date.
struct DateInterval
Citizens in Foundation
Conformances
protocol Comparable
A type that can be compared using the relational operators
<
,<=
,>=
, and>
.protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol CustomReflectable
A type that explicitly supplies its own mirror.
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Decodable
A type that can decode itself from an external representation.
protocol Encodable
A type that can encode itself to an external representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol ReferenceConvertible
Decorates types which are backed by a Foundation reference type.
Members
init(
) Initializes a
DateInterval
with start and end dates set to the current date and the duration set to0
.init(from: Decoder
) throws init(start: Date, duration: TimeInterval
) Initialize a
DateInterval
with the specified start date and duration.init(start: Date, end: Date
) Initialize a
DateInterval
with the specified start and end date.var customMirror: Mirror
var debugDescription: String
var description: String
var duration: TimeInterval
The duration.
var end: Date
The end date.
var start: Date
The start date.
static func < (DateInterval, DateInterval
) -> Bool static func == (DateInterval, DateInterval
) -> Bool func compare(DateInterval
) -> ComparisonResult Compare two DateIntervals.
func contains(Date
) -> Bool Returns
true
ifself
containsdate
.func encode(to: Encoder
) throws func hash(into: inout Hasher
) func intersection(with: DateInterval
) -> DateInterval? Returns a DateInterval that represents the interval where the given date interval and the current instance intersect.
func intersects(DateInterval
) -> Bool Returns
true
ifself
intersects thedateInterval
.typealias ReferenceType
Features
var halfWidthCornerQuoted: String
static func != (Self, Self
) -> Bool static func ... (Self
) -> PartialRangeFrom<Self> Returns a partial range extending upward from a lower bound.
static func ... (Self
) -> PartialRangeThrough<Self> Returns a partial range up to, and including, its upper bound.
static func ... (Self, Self
) -> ClosedRange<Self> Returns a closed range that contains both of its bounds.
static func ..< (Self
) -> PartialRangeUpTo<Self> Returns a partial range up to, but not including, its upper bound.
static func ..< (Self, Self
) -> Range<Self> Returns a half-open range that contains its lower bound but not its upper bound.