dateTime(date:time:locale:timeZone:calendar:)

Creates a regex component to match a localized date and time string and capture the string as a Date. The date string is expected to follow the format of what Date.FormatStyle(date:time:locale:calendar:) produces.

iOS
16.0+
macOS
13.0+
tvOS
16.0+
watchOS
9.0+
static func dateTime(date: Date.FormatStyle.DateStyle, time: Date.FormatStyle.TimeStyle, locale: Locale, timeZone: TimeZone, calendar: Calendar? = nil) -> Date.ParseStrategy

Parameters

date

The style that describes the date part of the string. For example, .numeric matches “10/21/2015”, and .abbreviated matches “Oct 21, 2015” as October 21, 2015 in the en_US locale.

time

The style that describes the time part of the string.

locale

The locale of the string to be matched.

timeZone

The time zone to create the matched date with. Ignored if the string contains a time zone and matches the specified style.

calendar

The calendar with which to interpret the date string. If set to nil, the default calendar of the specified locale is used.

Returns

A RegexComponent to match a localized date string.