Skip to main content

Overview

A date picker is a native control that lets a user select a date or time. Play’s date picker element uses Apple’s native iOS date picker. Date pickers can be customized according to the SwiftUI properties, and they automatically include all native functionality, like selecting dates or switching months. Date Picker Overview

Properties

Mode

Set if the date picker should display the date, the time, both the date & time, or a countdown timer:
  • Date: Allows the user to select a date (month, day, year).
  • Time: Allows the user to select a time (hour, minute, AM or PM)
  • Date & Time: Allows the user to select both a date and a time.
  • Count Down Timer: Allows the user to select a time to count from (hour and minute). (Only available in Wheels style)

Style

Set if the date picker’s style should be compact, inline, or wheels:
  • Compact: Show the data in a compact view that, when tapped, will expand for user interaction.
  • Inline: Show the full view (i.e. for date mode, it will show a full calendar).
  • Wheels: Show the date or time in a wheel interface which functions the same as a native picker.

Tint Color

Select the date picker’s accent color. (Not available for Wheels style)
DatePicker.tintColor
Type: color
Can get or set the tint color or an individual color property.

Expression Editor Properties

In addition to the properties below, date pickers also have access to general object properties in the Expression Editor.

Value

DatePicker.value
Add Day
DatePicker.value.addDay(days)
Returns a date updated by adding the provided amount of days.Add Month
DatePicker.value.addMonth(months)
Returns a date updated by adding the provided amount of months.Format
DatePicker.value.format("string")
Returns the formatted date using the provided format string. Set formatting below.Style
DatePicker.value.style(style, time)
Returns a locale-aware string for date formatted using style/time.
SymbolMeaningExample
yyyyYear (4 digits)2025
yyYear (2 digits)25
MMonth in year7, 12
MMMonth in year (2 digits)07, 12
MMMMonth in year (text)May, Oct
dDay in month1, 31
ddDay in month (2 digits)01, 31
EDay of the week (text)Sunday
DatePicker.value.format("M-d-yyyy")
Returns 7-1-2025.
SymbolMeaningExample
HHour in day (0-23)0, 23
HHHour in day (00-23)00, 23
hHour in am/pm (1-12)1, 12
hhHour in am/pm (01-12)01, 12
mMinute in hour0, 59
mmMinute in hour (2 digit)00, 59
sSecond in minute0, 59
ssSecond in minute (2 digits)00, 59
SMillisecond0, 999
aam/pm marketAM, PM
zTime zonePST
ZRFC 822 time zone-0800
DatePicker.value.format("h:mm a")
Returns 1:00 PM.

Day

DatePicker.day
Type: number
Values: 1 - 31
Can get or set the value.

Month

DatePicker.month
Type: number
Values: 1 - 12
Can get or set the value.

Year

DatePicker.year
Type: number
Values: ex. 1998
Can get or set the value.

Hour

DatePicker.hour
Type: number
Values: 1 - 24
Can get or set the value.

Minute

DatePicker.minute
Type: number
Values: 1 - 60
Can get or set the value.

Second

DatePicker.second
Type: number
Values: 1 - 60
Can get or set the value.

Resources

Related Triggers & Actions Projects

Date Picker Project

Links
I