Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ghost opened this issue Sep 25, 2023 · 0 comments
Closed

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

ghost opened this issue Sep 25, 2023 · 0 comments

Comments

@ghost
Copy link

ghost commented Sep 25, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant