<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/DatePicker/init(_:selection:in:displayedComponents:)-1666o",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI10DatePickerVA2A4TextVRszrlE_9selection2in19displayedComponentsACyAEGqd___AA7BindingVy10Foundation0C0VGs19PartialRangeThroughVyANGAA0cdI0VtcSyRd__lufc"
  },
  "title" : "init(_:selection:in:displayedComponents:)"
}
-->

# init(_:selection:in:displayedComponents:)

Creates an instance that selects a `Date` on or before some end date.

```
nonisolated init<S>(_ title: S, selection: Binding<Date>, in range: PartialRangeThrough<Date>, displayedComponents: DatePicker<Label>.Components = [.hourAndMinute, .date]) where S : StringProtocol
```

## Parameters

`title`

The title of `self`, describing its purpose.

`selection`

The date value being displayed and selected.

`range`

The open range before some selectable end date.

`displayedComponents`

The date components that user is able to
view and edit. Defaults to `[.hourAndMinute, .date]`. On watchOS,
if `.hourAndMinute` or `.hourMinuteAndSecond` are included with
`.date`, only `.date` is displayed.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)