DatePickerItems

data class DatePickerItems(val yearItems: List<Int>, val monthItems: List<Int>, val dayItems: List<Int>, val constraints: DatePickerConstraints = DatePickerConstraints())

Selectable item lists for io.github.kezlab.compose.pickers.date.DatePicker.

Lists must be non-empty, contain distinct values, stay within their documented ranges, and contain the current state selection. dayItems is filtered by the selected year/month maximum day and constraints before rendering. Treat item lists as immutable after passing them to a picker; create a new DatePickerItems when available values change.

Parameters

yearItems

Year values available for selection. Values must be in 1000..9999.

monthItems

Month values available for selection. Values must be in 1..12.

dayItems

Day values available for selection. Values must be in 1..31.

constraints

Inclusive date bounds applied after the year, month, and day item lists.

See also

Constructors

Link copied to clipboard
constructor(yearItems: List<Int>, monthItems: List<Int>, dayItems: List<Int>, constraints: DatePickerConstraints = DatePickerConstraints())

Properties

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

Functions

Link copied to clipboard
fun coerceDate(date: LocalDate): LocalDate

Returns the closest selectable date for date.

fun coerceDate(year: Int, month: Int, day: Int): LocalDate

Returns the closest selectable date for year, month, and day.

Link copied to clipboard

Returns the closest selectable ordered date range for dateRange.

fun coerceDateRange(startDate: LocalDate, endDate: LocalDate): DateRange

Returns the closest selectable ordered date range for startDate and endDate.

fun coerceDateRange(startYear: Int, startMonth: Int, startDay: Int, endYear: Int, endMonth: Int, endDay: Int): DateRange

Returns the closest selectable ordered date range for explicit start and end date parts.

Link copied to clipboard
fun contains(dateRange: DateRange): Boolean

Returns whether both boundaries of dateRange are directly selectable.

fun contains(date: LocalDate): Boolean

Returns whether date is directly selectable.

fun contains(startDate: LocalDate, endDate: LocalDate): Boolean

Returns whether startDate and endDate are directly selectable range boundaries.

fun contains(year: Int, month: Int, day: Int): Boolean

Returns whether year, month, and day are directly selectable.

fun contains(startYear: Int, startMonth: Int, startDay: Int, endYear: Int, endMonth: Int, endDay: Int): Boolean

Returns whether explicit start and end date parts are directly selectable range boundaries.