selectTime

fun selectTime(time: LocalTime)

Programmatically selects time.

The hour is converted to the current timeFormat. In 12-hour mode, the AM/PM period is derived from time. In 24-hour mode, selectedPeriod is still updated for consistency but is not formatted by TimePicker. The hour, minute, and period fields are applied together as one logical state update.


fun selectTime(hour: Int, minute: Int)

Programmatically selects a time from 24-hour clock parts.

hour is interpreted as hour-of-day in 0..23. In 12-hour mode, the format hour and AM/PM period are derived from hour.

Throws

if hour or minute is outside the supported range.


fun selectTime(displayHour: Int, minute: Int, period: TimePeriod)

Programmatically selects a time from a 12-hour display value.

displayHour is interpreted as the format-hour shown to users in 1..12; period supplies AM/PM. The resulting time is stored as selectedTime and rendered in this state's timeFormat.

Throws

if displayHour or minute is outside the supported range.


fun selectTime(time: LocalTime, items: TimePickerItems)

Programmatically selects the closest time to time that is allowed by items.

Use this overload when app-owned state can contain values outside custom picker lists or time bounds.


fun selectTime(hour: Int, minute: Int, items: TimePickerItems)

Programmatically selects the closest time to hour and minute that is allowed by items.

hour is interpreted as hour-of-day in 0..23.


fun selectTime(displayHour: Int, minute: Int, period: TimePeriod, items: TimePickerItems)

Programmatically selects the closest time to a 12-hour display value allowed by items.

displayHour is interpreted as the format-hour shown to users in 1..12; period supplies AM/PM.