Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android DatePicker/Dialog displaying incorrect month/s using min/max date

I'm using the DatePickerDialog and the DatePicker to set a specific range.

datePicker.setMinDate(minDate);
datePicker.setMaxDate(maxDate);

If my min/max - dates are in the range of one month (eg.: 7.2.2014 - 27.2.2014), i still get the neighbour months displayed in the dialog (Jan, Mar). If i choose the last month (Jan), the dialog automatically swaps to the minDate and the month switches back to Feb. Same thing for the future month.

enter image description here

Is there a way to fix this, so that i only get the months displayed, which are in my range?

like image 559
Maxi Avatar asked Nov 10 '22 12:11

Maxi


1 Answers

In Android Month start from zero.....

So u have to use zero for january and 11 for December

like image 119
Shah Avatar answered Nov 15 '22 11:11

Shah