DateRangePickerState

class DateRangePickerState(initialStartDate: LocalDate, initialEndDate: LocalDate)

State holder for DateRangePicker.

The selected range is always inclusive and ordered. If selectStartDate moves the start after the current end, the end date is moved to the same date. If selectEndDate moves the end before the current start, the start date is moved to the same date.

Parameters

initialStartDate

The initial range start date.

initialEndDate

The initial range end date.

Throws

if initialStartDate is after initialEndDate.

Constructors

Link copied to clipboard
constructor(initialStartDate: LocalDate, initialEndDate: LocalDate)
constructor(initialDateRange: DateRange)

Creates a DateRangePickerState from initialDateRange.

constructor(initialStartYear: Int, initialStartMonth: Int, initialStartDay: Int, initialEndYear: Int = initialStartYear, initialEndMonth: Int = initialStartMonth, initialEndDay: Int = initialStartDay)

Creates a DateRangePickerState with explicit start and end date parts.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The selected inclusive date range.

Link copied to clipboard
val selectedEndDate: LocalDate

The last selected date.

Link copied to clipboard
val selectedStartDate: LocalDate

The first selected date.

Functions

Link copied to clipboard
fun selectDateRange(dateRange: DateRange)

Programmatically selects dateRange.

fun selectDateRange(dateRange: DateRange, items: DatePickerItems)

Programmatically selects the closest date range to dateRange allowed by items.

fun selectDateRange(startDate: LocalDate, endDate: LocalDate)

Programmatically selects startDate and endDate.

fun selectDateRange(startDate: LocalDate, endDate: LocalDate, items: DatePickerItems)

Programmatically selects the closest date range allowed by items.

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

Programmatically selects the range from explicit start and end date parts.

fun selectDateRange(startYear: Int, startMonth: Int, startDay: Int, endYear: Int, endMonth: Int, endDay: Int, items: DatePickerItems)

Programmatically selects the closest date range to the requested date parts allowed by items.

Link copied to clipboard
fun selectEndDate(date: LocalDate)

Programmatically selects the range end date.

fun selectEndDate(date: LocalDate, items: DatePickerItems)

Programmatically selects the closest range end date allowed by items.

fun selectEndDate(year: Int, month: Int, day: Int)

Programmatically selects the range end date from explicit date parts.

fun selectEndDate(year: Int, month: Int, day: Int, items: DatePickerItems)

Programmatically selects the closest range end date to year, month, and day allowed by items.

Link copied to clipboard
fun selectStartDate(date: LocalDate)

Programmatically selects the range start date.

fun selectStartDate(date: LocalDate, items: DatePickerItems)

Programmatically selects the closest range start date allowed by items.

fun selectStartDate(year: Int, month: Int, day: Int)

Programmatically selects the range start date from explicit date parts.

fun selectStartDate(year: Int, month: Int, day: Int, items: DatePickerItems)

Programmatically selects the closest range start date to year, month, and day allowed by items.