I have created a DatePickerDialog and I am trying to limit the picker to the max date of "today" (currently: 2020, 13 Jul), like this:
DatePickerDialog(
activity,
OnDateSetListener { _: DatePicker?, year: Int, monthOfYear: Int, dayOfMonth: Int ->
selectedBirthday.set(year, monthOfYear, dayOfMonth)
},
1980, 7, 2
).apply {
datePicker.maxDate = System.currentTimeMillis() // max date = today
}.show()
The dialog opens correctly with default data ("1980, Aug 02").
However, I have found a bug when "1980, Aug 02" is selected and I change the year to 2020: The dialog then shows "2020, Aug 02" on top ignoring the maxDate limit setup on the datePicker, but the calendar below is correctly limited to July 13.
If I click on "OK" button, the year, monthOfYear and dayOfMonth returned on my DateSetListener are 2020, Aug, 02, which is a future date from what I wanted. Is there any workaround to avoid this bug on the DatePickerDialog with the maxDate being ignored?

applyblock:updateDate(1980, 7, 2). - Jenea Vranceanu