Skip to content

Instantly share code, notes, and snippets.

@PriyaSindkar
Created June 26, 2023 11:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PriyaSindkar/2b6c5d4ca00377e26900ba3c9df33314 to your computer and use it in GitHub Desktop.
Save PriyaSindkar/2b6c5d4ca00377e26900ba3c9df33314 to your computer and use it in GitHub Desktop.
Selectable Dates for DatePicker from Material 3- enable and disable dates available for selection
val datePickerState =
rememberDatePickerState(initialSelectedDateMillis = System.currentTimeMillis(),
selectableDates = object : SelectableDates {
override fun isSelectableDate(utcTimeMillis: Long): Boolean {
val date = Date().apply {
time = utcTimeMillis
}
val currentDate = Date()
return date.before(currentDate)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment