View Source DatePicker

<DatePicker>

A control that lets the user pick a date.

Overview

The value of this control is an Elixir-style ISO 8601 date or datetime string (i.e., the result of DateTime.to_iso8601).

<DatePicker selection="2023-03-14T15:19:26.535Z">
    <Text>Pick a date</Text>
</DatePicker>

Children of the DatePicker element are used as the label for the control.

Specifying a Date Range

You can optionally specify a start and/or end date to limit the selectable range of the date picker.

Attributes

SwiftUI Documentation

See SwiftUI.DatePicker for more details on this View.

References

Link to this reference

displayedComponents

Which components of the date to display in the picker. Defaults to all.

Discussion

Possible values:

  • hourAndMinute
  • date

The end date (inclusive) of the valid date range. Encoded as an ISO 8601 date or datetime string.

The start date (inclusive) of the valid date range. Encoded as an ISO 8601 date or datetime string.