Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DatePickerDialog not Displaying Last Week

I have implemented DatePickerDialog in my app and I am having the following issues with Lollipop only.

Code Snippet:

void setDate(final EditText ed) {
    Calendar mcurrentTime = Calendar.getInstance();
    int day = mcurrentTime.get(Calendar.DAY_OF_MONTH);
    int month = mcurrentTime.get(Calendar.MONTH);
    int year = mcurrentTime.get(Calendar.YEAR);
    DatePickerDialog mTimePicker;
    mTimePicker = new DatePickerDialog(getContext(), new OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker view, int selectedYear, int monthOfYear, int dayOfMonth) {
            // TODO Auto-generated method stub
            monthOfYear += 1;
            ed.setText(selectedYear + "-" + monthOfYear + "-" + dayOfMonth);
        }
    }, year, month, day);
    //mTimePicker.setTitle("Select Date:");
    mTimePicker.show();
}

I am not able to select date of last week and on pressing next it's displaying next month.

Has anyone run into a problem like this? Does anyone have a solution?

Any help is appreciated, thank you.

like image 928
Pratik Butani Avatar asked Jan 27 '26 15:01

Pratik Butani


1 Answers

I'm seeing the same issue as well.

It has nothing to do with min or max dates set on the datepicker...

It seems to be an issue arising from the screen size being small and thus the datepicker cuts off the last week of the month(or more if the screen in really small) and the 'days' area is not scrollable(up/down)... scrolling left/right will take you to the previous/next month...

My idea for a fix would be to make the 'days' area of the datepicker vertically scrollable but as this is a default android widget I am not sure how to go about doing this -_-

P.S. I know this is not an answer but my rep prevents me from making a comment thus this is the only option open to me...

like image 87
ProjectDelta Avatar answered Jan 30 '26 04:01

ProjectDelta



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!