DateRangePickerState


A state object that can be hoisted to observe the date range picker state. See rememberDateRangePickerState.

Summary

Public functions

Unit
setSelection(startDateMillis: Long?, endDateMillis: Long?)

Sets a start and end selection dates.

Cmn

Public properties

DisplayMode

A DisplayMode that represents the current UI mode (i.e. picker or input).

Cmn
Long

A timestamp that represents the currently displayed month start date in UTC milliseconds from the epoch.

Cmn
SelectableDates

A SelectableDates that is consulted to check if a date is allowed.

Cmn
Long?

A timestamp that represents the selected end date start of the day in UTC milliseconds from the epoch.

Cmn
Long?

A timestamp that represents the selected start date start of the day in UTC milliseconds from the epoch.

Cmn
IntRange

An IntRange that holds the year range that the date picker will be limited to.

Cmn

Public functions

setSelection

fun setSelection(startDateMillis: Long?, endDateMillis: Long?): Unit

Sets a start and end selection dates.

The function expects the dates to be within the state's year-range, and for the start date to appear before, or be equal, the end date. Also, if an end date is provided (e.g. not null), a start date is also expected to be provided. In any other case, an IllegalArgumentException is thrown.

Parameters
startDateMillis: Long?

timestamp in UTC milliseconds from the epoch that represents the start date selection. Provide a null to indicate no selection.

endDateMillis: Long?

timestamp in UTC milliseconds from the epoch that represents the end date selection. Provide a null to indicate no selection.

Throws
kotlin.IllegalArgumentException

in case the given timestamps do not comply with the expected values specified above.

Public properties

displayMode

var displayModeDisplayMode

A DisplayMode that represents the current UI mode (i.e. picker or input).

displayedMonthMillis

var displayedMonthMillisLong

A timestamp that represents the currently displayed month start date in UTC milliseconds from the epoch.

Throws
kotlin.IllegalArgumentException

in case the value is set with a timestamp that does not fall within the yearRange.

selectableDates

val selectableDatesSelectableDates

A SelectableDates that is consulted to check if a date is allowed.

In case a date is not allowed to be selected, it will appear disabled in the UI.

selectedEndDateMillis

val selectedEndDateMillisLong?

A timestamp that represents the selected end date start of the day in UTC milliseconds from the epoch.

See also
setSelection

for setting this value along with the selectedStartDateMillis.

selectedStartDateMillis

val selectedStartDateMillisLong?

A timestamp that represents the selected start date start of the day in UTC milliseconds from the epoch.

See also
setSelection

for setting this value along with the selectedEndDateMillis.

yearRange

val yearRangeIntRange

An IntRange that holds the year range that the date picker will be limited to.