---
title: DatePicker
description: Presents a date picker.
---

Presents a date picker.

Use the date picker to select a date. After configuring the date picker, call `pickTime()`, `pickDate()`, `pickDateAndTime()` or `pickCountDownTimer()` which will present the date picker modally. The `pickTime()`, `pickDate()` and `pickDateAndTime()` methods returns a promise that carries the selected date and the `pickCountDownTimer()` method retrns a promise that carries the selected duration.

The date picker can be configured towards picking a date with or without time, just a time or picking hours and minutes for a timer.

## Properties

### countdownDuration

Countdown duration displayed by the date picker.

```typescript
countdownDuration: number
```

Use this property to get and set the duration of a countdown when calling the `pickCountDownDuration()` function to present the picker. The default value is zero and the maximum value is 23:59 (86,399 seconds).

### initialDate

The initially selected date.

```typescript
initialDate: Date
```

Use this property to specify the initially selected date and time when picking a date, a time or both using date picker. If no date is specified, the current date and time will be selected initially.

Be aware that this property does not hold the selected date after the date picker has been dismissed. The promises returned by `pickTime()`, `pickDate()` and `PickDateAndTime()` carries the selected date.

### maximumDate

Maximum date that is selected in the picker.

```typescript
maximumDate: Date
```

The maximum date, along with the minimum date, specifies the valid date range. The minimum and maximum dates are ignored if the minimum date is greater than the maximum date. The dates are also ignored in countdown-timer mode.

### minimumDate

Minimum date that is selected in the picker.

```typescript
minimumDate: Date
```

The minimum date, along with the maximum date, specifies the valid date range. The minimum and maximum dates are ignored if the minimum date is greater than the maximum date. The dates are also ignored in countdown-timer mode.

### minuteInterval

Interval at which the date picker displays minutes.

```typescript
minuteInterval: number
```

Use the property to set the interval of the minute wheel. The default and minimum value is 1 and the maximum value is 30.

## Methods

<span id="-new-datepicker" class="api-anchor"></span>

### new DatePicker()

Constructs a new date picker.

```typescript
new DatePicker()
```

Use the date picker to present a view for selecting a date.

The date picker can be configured towards picking a date with or
without time, just a time or picking hours and minutes for a timer.

<span id="-pickcountdownduration" class="api-anchor"></span>

### pickCountdownDuration()

Presents the date picker for selecting the duration of a countdown.

```typescript
pickCountdownDuration(): Promise<number>
```

Use the method to pick the duration of a countdown, e.g. a timer. The date picker will display hours and minutes. Use the `countdownDuration` property to set the initially selected duration.

#### Return value

**`Promise<number>`**

Promise that carries the selected duration when fulfilled.

<span id="-pickdate" class="api-anchor"></span>

### pickDate()

Presents the date picker displaying day, month and year.

```typescript
pickDate(): Promise<Date>
```

Use the method to pick a date. The date picker will display the,
day, month and year. Use the `initialDate` property to set the initially selected date.

#### Return value

**`Promise<Date>`**

Promise that carries the selected date when fulfilled.

<span id="-pickdateandtime" class="api-anchor"></span>

### pickDateAndTime()

Presents the date picker displaying date and time.

```typescript
pickDateAndTime(): Promise<Date>
```

Use the method to pick a date and a time. The date picker will display the day, month, year, hour, minutes and, depending on the locale of the device, an AM/PM designation. Use the `initialDate` property to set the initially selected date.

#### Return value

**`Promise<Date>`**

Promise that carries the selected date and time when fulfilled.

<span id="-picktime" class="api-anchor"></span>

### pickTime()

Presents the date picker displaying hours and minutes.

```typescript
pickTime(): Promise<Date>
```

Use the method to pick a time. The date picker will display hours and minutes and, depending on the locale of the device, an AM/PM designation.

The returned date will be the current date with the hour and minute set to the selected values. Use the `initialDate` property to set the initially selected date.

#### Return value

**`Promise<Date>`**

Promise that carries the selected time when fulfilled.