setSelection

Function
JvmAndAndroid
@RequiresApi(26)
fun DateRangePickerState.setSelection(startDate: LocalDate?, endDate: LocalDate?)

Sets the DateRangePickerState start and end dates selection.

The provided LocalDates are converted to the start of the day (midnight) in UTC and applied to the DateRangePickerState.

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

startDate a LocalDate that represents the start date selection. Provide a null to indicate no selection.
endDate a LocalDate that represents the end date selection. Provide a null to indicate no selection.