LocalDate

struct LocalDate
extension LocalDate : AutomationValue, Copyable, Decodable, Encodable, Equatable, Escapable, Hashable, Sendable, Sendable, StructDataRepresentable

Represents 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
  • day

    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

    year

    The year of the date.

    month

    The month of the date.

    day

    The day of the date.

  • Initializes LocalDate with the trait decoder.

    Declaration

    Swift

    init(decoder: TraitDecoder) throws

    Parameters

    decoder

    The trait decoder to decode the local date.

  • The month enum, representing the month of the year.

    Declaration

    Swift

    enum Month
    extension LocalDate.Month : AutomationValue, Copyable, Decodable, Encodable, Enum, Enum8, Equatable, Escapable, Hashable, RawRepresentable, Sendable, Sendable
  • Encodes LocalDate to 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 LocalDate by converting the given dateComponents.

    Throws

    when dateComponents have at least a nil year, month or day, or if they are not valid in the Gregorian calendar.

    Declaration

    Swift

    init(dateComponents: DateComponents) throws

    Parameters

    dateComponents

    The date components with the year, month and day to use.

  • The DateComponents representation of this date.

    Declaration

    Swift

    var dateComponents: DateComponents { get }
  • Undocumented

    Declaration

    Swift

    enum StructFields
    extension LocalDate.StructFields : Equatable, Field, Hashable, RawRepresentable, Sendable
  • 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