# Date Picker

Date pickers pickers provide a simple way to select a single value from a pre-determined set.

Date pickers can be used in [Forms](/apps/components/inputs/form.md) and [Steppers](/apps/components/navigation/stepper.md).

![](/files/zXg34nOmsbKZa0V8YWCv)

```powershell
New-UDDatePicker
```

## OnChange Event Handler

The OnChange event handler is called when the date changes. You can access the current date by using the `$Body` variable.

```powershell
New-UDDatePicker -OnChange {
    Show-UDToast -Message $body
}
```

## Variant

You can customize how the date picker is shown. The default is the `inline` variant that displays the date picker popup in line with the input control. The `static` variant displays the date picker without having to click anything.

```powershell
New-UDDatePicker -Variant static
```

## Locale

To set the locate of the date picker, specify the `-Locale` parameter.

```powershell
New-UDDatePicker -Locale fr
```

![](/files/eFVdTuDsj9HfPU201TOh)

## Minimum and Maximum

By default, the user can select any date. To specify minimum and maximum dates, using the `-Minimum` and `-Maximum` parameters.

```powershell
New-UDDatePicker -Minimum ((Get-Date).AddDays(-15)) -Maximum ((Get-Date).AddDays(15))
```

## Views

You can limit which portions of the date picker are included by using the `-Views` parameter. For example, if you wanted to remove the year selector and limit to the current year, you could do the following.

```powershell
$Year = (Get-Date).Year
$MinDate = [DateTime]::new($year, 1, 1)
$MaxDate = [DateTime]::new($year, 12, 31)
New-UDDatePicker -Views "day" -MinimumDate $MinDate -MaximumDate $MaxDate
```

## API

* [New-UDDatePicker](https://github.com/ironmansoftware/universal-docs/blob/v5/cmdlets/New-UDDatePicker.txt)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.powershelluniversal.com/apps/components/inputs/date-picker.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
