Skip to content
Block Kit for React
Esc
↑↓navigate↵open⌘Jpreview
On this page

Datetime picker element

A date field and a time field that set one timestamp, like Slack's datetimepicker.

datetimepicker shows a date field and a time field side by side, which set a single Unix timestamp together. In a message too narrow for both, such as on a phone, the time field moves under the date field and each takes the full width, as in Slack. The date field is the date picker’s field: it opens the same calendar, takes a typed date, and selects its date when tabbed into. The time field opens the same hourly list as the time picker, typeable for a time off the hour. Slack allows it in actions and input blocks, in messages and modals; it isn’t available as a section accessory or in App Home.

Your AppAPP
Starts at

Time zone: Monrovia, Reykjavik

onActionInteract with the preview.

Fields

PropType
typestring

Always datetimepicker.

Typestring
action_id?string

Identifies this element in the block_actions payload. Must be unique within a block.

Typestring
initial_date_time?number

The date and time selected when the element loads, as a 10-digit Unix timestamp in seconds, e.g. 1628633820.

Typenumber
confirm?ConfirmationDialog

A confirmation dialog shown before a picked date or time takes effect.

TypeConfirmationDialog
focus_on_load?boolean

Focuses this element when its modal opens. Only one element per view. Slack ignores it in messages.

Typeboolean
Defaultfalse

Examples

Without an initial value

Your AppAPP

Time zone: Monrovia, Reykjavik

onActionInteract with the preview.

The fields show their placeholders (“Select a date” / “Time”) until the user picks either part. Picking a day first fills the time with the current time, to the minute; picking a time first fills the date with today. As in Slack, the date field calls today “Today” and the day after “Tomorrow”.

With an initial value

Your AppAPP

Time zone: Monrovia, Reykjavik

onActionInteract with the preview.

Inside an input block

Your AppAPP
Starts at

Time zone: Monrovia, Reykjavik

With a confirmation dialog

Your AppAPP

Time zone: Monrovia, Reykjavik

onActionInteract with the preview.

The dialog appears after the user picks a date or a time, before the new value takes effect.

Interactivity

Every change fires an action straight away, as in Slack: picking or typing a day, picking or typing a time, and “Clear selection”. selected_date_time is a Unix timestamp in seconds, and null once cleared. When the element has an initial_date_time, the action echoes it:

{
  "type": "datetimepicker",
  "action_id": "starts_at",
  "block_id": "when",
  "selected_date_time": 1718872500,
  "initial_date_time": 1718461800
}

Once a value is chosen, “Clear selection” leads the time list and is the calendar’s footer. It empties both fields and sends "selected_date_time": null. As in Slack, it’s offered in an actions block and wherever the value may be left empty: in a modal or on App Home, a required input block’s datetimepicker has none.

The same shape lands in state.values[block_id][action_id]:

{
  "type": "datetimepicker",
  "selected_date_time": 1718872500
}

When initial_date_time is set, that value is reported as state as soon as the element mounts, before any interaction.

Time zone

BlockKitProvider’s timeZone prop (an IANA zone like Europe/Amsterdam) is the zone the picker works in. The fields show the date and time in it, the calendar opens on that wall-clock date, “Today” and the current time are read in it, and the date and time the user picks are read in it: picking 11:00 on 1 January 2026 with Europe/Amsterdam sends 1767261600 (10:00 UTC). The hint underneath names the zone (e.g. “Time zone: Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna”). selected_date_time itself is always a Unix timestamp, exactly as Slack sends it. On a daylight saving change, a time the clocks skip moves forward by the gap and a time they repeat takes its first occurrence. Without a timeZone prop, the picker works in UTC.

Last updated on