struct YearMonth
extension YearMonth : AutomationValue, Copyable, Decodable, Encodable, Equatable, Escapable, Hashable, Sendable, Sendable, StructDataRepresentable
Represents year and month.
This struct doesn’t include any time zone related information.
-
The year component.
Declaration
Swift
let year: Int32
-
The month component.
Declaration
Swift
let month: LocalDate.Month
-
Initializes the
YearMonth
with the year, month.Declaration
Swift
init(year: Int32, month: LocalDate.Month)
-
Initializes
YearMonth
with the trait decoder.Declaration
Swift
init(decoder: TraitDecoder) throws
-
Encodes
YearMonth
to the trait encoder.Declaration
Swift
func encode(with encoder: TraitEncoder) throws
-
Initializes a
YearMonth
by converting the givendateComponents
.Throws
whendateComponents
have at least anil
year
,month
, or if they are not valid in the Gregorian calendar.Declaration
Swift
init(dateComponents: DateComponents) throws
-
The
DateComponents
representation of this year month.Declaration
Swift
var dateComponents: DateComponents { get }
-
Returns the field corresponding to the given field ID.
Declaration
Swift
static func structField(id: UInt32) -> (any Field)?
-
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