maxkeppeler / sheets-compose-dialogs

✨ Enhancing Android UIs: A Jetpack Compose Library supporting a wide range of common use-cases with Material Design 3 Dialogs, Popups, and Bottom Sheets. ✨
https://maxkeppeler.github.io/sheets-compose-dialogs/
Apache License 2.0
780 stars 32 forks source link

Set default selection date. For ex- age restricion for 18 year+ #70

Closed ghost closed 8 months ago

ghost commented 9 months ago

How can we set the default selection date . If to select a dob which make the ages mre than 18 years only. How can we make the calendar start form a given year. Want to start the calendar from a given date . val timeBoundary = LocalDate.now().let { now -> now.minusYears(100).. now.minusYears(18) }

CalendarDialog(
    state = rememberUseCaseState(visible = true, true, onCloseRequest = {
        hide()
    }),
    config = CalendarConfig(
        yearSelection = true,
        monthSelection = true,
        boundary = timeBoundary,
        style = CalendarStyle.MONTH,
    ),
    selection = CalendarSelection.Date {
        mDate.value = it.format(formatter)
        onValueChanged(mDate.value)
    },

)

still the calendar starts from 2023

but when selecting year it works as expected.