struct LocalDateextension LocalDate : AutomationValue, Comparable, Copyable, Copyable, Decodable, Encodable, Equatable, Equatable, Equatable, Escapable, Escapable, Hashable, Hashable, Sendable, SendableRepresents a date.
This struct doesn’t include any time zone related information.
-
The year of the date.
Declaration
Swift
let year: Int32 -
The month of the date.
Declaration
Swift
let month: LocalDate.Month -
The day of the date.
Declaration
Swift
let day: Int32 -
Initializes the local date with the year, month, day.
Declaration
Swift
init(year: Int32, month: LocalDate.Month, day: Int32)Parameters
yearThe year of the date.
monthThe month of the date.
dayThe day of the date.
-
Initializes
LocalDatewith the trait decoder.Declaration
Swift
init(decoder: TraitDecoder) throwsParameters
decoderThe trait decoder to decode the local date.
-
The month enum, representing the month of the year.
Declaration
Swift
enum Monthextension LocalDate.Month : AutomationValue, Copyable, Decodable, Encodable, Enum, Enum8, Equatable, Equatable, Escapable, Hashable, Hashable, RawRepresentable, Sendable, Sendable -
Encodes
LocalDateto the trait encoder.Declaration
Swift
func encode(with encoder: TraitEncoder) throws -
The Month and day components of the date.
Declaration
Swift
var monthDay: MonthDay { get } -
The year and month components of the date.
Declaration
Swift
var yearMonth: YearMonth { get } -
Initializes a
LocalDateby converting the givendateComponents.Throws
whendateComponentshave at least anilyear,monthorday, or if they are not valid in the Gregorian calendar.Declaration
Swift
init(dateComponents: DateComponents) throws -
The
DateComponentsrepresentation of this date.Declaration
Swift
var dateComponents: DateComponents { get } -
Returns a Boolean value indicating whether the value of the first argument is less than that of the second argument.
This function is the only requirement of the
Comparableprotocol. The remainder of the relational operator functions are implemented by the standard library for any type that conforms toComparable.Declaration
Swift
static func < (lhs: LocalDate, rhs: LocalDate) -> BoolParameters
lhsA value to compare.
rhsAnother value to compare.
-
Returns a Boolean value indicating whether two values are equal.
Equality is the inverse of inequality. For any values
aandb,a == bimplies thata != bisfalse.Declaration
Swift
static func == (lhs: LocalDate, rhs: LocalDate) -> BoolParameters
lhsA value to compare.
rhsAnother value to compare.
-
Creates a new instance by decoding from the given decoder.
This initializer throws an error if reading from the decoder fails, or if the data read is corrupted or otherwise invalid.
Declaration
Swift
init(from decoder: any Decoder) throws