MaterialDatePicker
Is there a way to set a validator for the previous days from today? Such that all days after today are invalid. In a scenario where the date picker is used for selecting dates for a report. You can get reports for the future
I'm not super familiar with DatePicker component but have you tried with CalendarConstraint class?
In the catalog sample app there is a DateValidatorWeekDays which uses the DateValidator defined inside and it seems customizable for your own logic (check the isValid method)
Don't know if this can be helpful to your use case but you could try if you didn't yet
That's correct, you should be able to use isValid in CalendarConstraint
@KelvinPac You can use this:
@Parcelize
class BirthdateSelectionValidator : CalendarConstraints.DateValidator {
override fun isValid(date: Long): Boolean = date <= System.currentTimeMillis()
}
Most helpful comment
@KelvinPac You can use this: