TimePickerItems

data class TimePickerItems(val minuteItems: List<Int>, val hour24Items: List<Int>, val hour12Items: List<Int>, val periodItems: List<TimePeriod>, val constraints: TimePickerConstraints = TimePickerConstraints())

Selectable item lists for io.github.kezlab.compose.pickers.time.TimePicker.

Lists must be non-empty, contain distinct values, stay within their documented ranges, and contain the current state selection for the active time format. constraints are applied after the hour, minute, and period item lists. Treat item lists as immutable after passing them to a picker; create a new TimePickerItems when available values change.

Parameters

minuteItems

Minute values available for selection. Values must be in 0..59.

hour24Items

Hour values available when using 24-hour time. Values must be in 0..23.

hour12Items

Display-hour values available when using 12-hour time. Values must be in 1..12.

periodItems

AM/PM values available when using 12-hour time.

constraints

Inclusive time bounds applied after the hour, minute, and period item lists.

See also

Constructors

Link copied to clipboard
constructor(minuteItems: List<Int>, hour24Items: List<Int>, hour12Items: List<Int>, periodItems: List<TimePeriod>, constraints: TimePickerConstraints = TimePickerConstraints())

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun coerceTime(time: LocalTime, timeFormat: TimeFormat = TimeFormat.HOUR_24): LocalTime

Returns the closest selectable time for time under timeFormat.

fun coerceTime(hour: Int, minute: Int, timeFormat: TimeFormat = TimeFormat.HOUR_24): LocalTime

Returns the closest selectable time for hour and minute under timeFormat.

fun coerceTime(displayHour: Int, minute: Int, period: TimePeriod): LocalTime

Returns the closest selectable time for a 12-hour display value.

Link copied to clipboard
fun contains(time: LocalTime, timeFormat: TimeFormat = TimeFormat.HOUR_24): Boolean

Returns whether time is directly selectable under timeFormat.

fun contains(hour: Int, minute: Int, timeFormat: TimeFormat = TimeFormat.HOUR_24): Boolean

Returns whether hour and minute are directly selectable under timeFormat.

fun contains(displayHour: Int, minute: Int, period: TimePeriod): Boolean

Returns whether displayHour, minute, and period are directly selectable in 12-hour mode.