coerceDateRange

Returns the closest selectable ordered date range for dateRange.

Start and end dates are coerced independently using coerceDate, then ordered so the returned DateRange always has startDate <= endDate. This is useful before creating io.github.kezlab.compose.pickers.date.DateRangePickerState or applying app-owned range presets with custom picker items.

Throws

if the configured item lists are invalid.


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

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

Unlike DateRange, this overload accepts unordered inputs so apps can normalize form, restored, or preset values in one step.

Throws

if the configured item lists are invalid.


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.

If a day is greater than the maximum day for its year/month, it is clamped before applying this item's selectable values and date bounds.

Throws

if any year/month/day value is outside its supported range, or if the configured item lists are invalid.