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

Get Selected Date? #4

Open
FelipeCoro opened this issue Nov 8, 2023 · 1 comment
Open

Get Selected Date? #4

FelipeCoro opened this issue Nov 8, 2023 · 1 comment

Comments

@FelipeCoro
Copy link

Hi Im sorry but it is unclear how to get the actual selected date.

@j-roskopf
Copy link

j-roskopf commented Nov 10, 2023

Here is a sample of how it can be done with the date picker state

    @Composable
    private fun Test(
        onSelectedDates: (List<LocalDate>) -> Unit
    ) {
        val state = rememberEpicDatePickerState(
            selectionMode = EpicDatePickerState.SelectionMode.Single(maxSize = Int.MAX_VALUE),
            config = rememberEpicDatePickerConfig(
                pagerConfig = rememberEpicCalendarPagerConfig(
                    basisConfig = rememberBasisEpicCalendarConfig(
                        displayDaysOfAdjacentMonths = false
                    )
                ),
                selectionContentColor = MaterialTheme.colorScheme.onPrimary,
                selectionContainerColor = MaterialTheme.colorScheme.primary
            )
        )
        Column {
            Text("current year and month: ${state.pagerState.currentMonth.year} ${state.pagerState.currentMonth.month.name}")
            EpicDatePicker(
                state = state
            )
        }

        LaunchedEffect(state.selectedDates) {
            // dates changed
            onSelectedDates(state.selectedDates)
        }
    }

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

2 participants