Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4f2b9ad2 authored by George Mount's avatar George Mount
Browse files

Fixes minimum date in DatePicker

Fixes: 158448787

When the day is earlier in than the minimum date, but
the year is later, then the year is changed, the date
gets set to a day that is earlier than the minimum date.
This CL ensures that the year change can't bring the
date outside of the range of minimum to maximum dates.

Test: manual testing
Change-Id: I0034bd513275267ecf9554f673533852e68dd854
parent c70b38a9
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -259,6 +259,11 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate {
            }
            }


            mCurrentDate.set(Calendar.YEAR, year);
            mCurrentDate.set(Calendar.YEAR, year);
            if (mCurrentDate.compareTo(mMinDate) < 0) {
                mCurrentDate.setTimeInMillis(mMinDate.getTimeInMillis());
            } else if (mCurrentDate.compareTo(mMaxDate) > 0) {
                mCurrentDate.setTimeInMillis(mMaxDate.getTimeInMillis());
            }
            onDateChanged(true, true);
            onDateChanged(true, true);


            // Automatically switch to day picker.
            // Automatically switch to day picker.