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

Commit d7419986 authored by Svetoslav Ganov's avatar Svetoslav Ganov
Browse files

Down arrow on the month can end up at the start of the month

bug:3338078

1. The bug was that I was claculating delta month and day from
   the current date but was changing the latter in the middle
   thus causing inconsistent state.

Change-Id: Id3082b01778fc2b3116aa412aff3f12e9ebf0c97
parent 9fafe4e0
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -514,10 +514,11 @@ public class DatePicker extends FrameLayout {
     * inconsistent date the values are normalized before updating the spinners.
     */
    private void updateSpinners(int year, int month, int dayOfMonth) {
        mCurrentDate.set(Calendar.YEAR, year);
        // compute the deltas before modifying the current date
        int deltaMonths = getDelataMonth(month);
        mCurrentDate.add(Calendar.MONTH, deltaMonths);
        int deltaDays = getDelataDayOfMonth(dayOfMonth);
        mCurrentDate.set(Calendar.YEAR, year);
        mCurrentDate.add(Calendar.MONTH, deltaMonths);
        mCurrentDate.add(Calendar.DAY_OF_MONTH, deltaDays);

        if (mCurrentDate.before(mMinDate)) {