Contents

iso8601Components(timeZone:includingFractionalSeconds:dateSeparator:dateTimeSeparator:timeSeparator:)

Creates a regex component to match an ISO 8601 date and time string without time zone, and capture the string as a DateComponents using the specified timeZone. If the string contains time zone designators, matches up until the start of time zone designators.

Declaration

static func iso8601Components(timeZone: TimeZone, includingFractionalSeconds: Bool = false, dateSeparator: Date.ISO8601FormatStyle.DateSeparator = .dash, dateTimeSeparator: Date.ISO8601FormatStyle.DateTimeSeparator = .standard, timeSeparator: Date.ISO8601FormatStyle.TimeSeparator = .colon) -> Self

Parameters

  • timeZone:

    The time zone to create the captured DateComponents with.

  • includingFractionalSeconds:

    Specifies if the string contains fractional seconds.

  • dateSeparator:

    The separator between date components.

  • dateTimeSeparator:

    The separator between date and time parts.

  • timeSeparator:

    The separator between time components.

Return Value

A RegexComponent to match an ISO 8601 string.