简体   繁体   中英

Material Date Range Picker showing incorrect current date Android

The current date in the Material Date Range picker is showing as yesterday's date. I looked into source code for the Material Design Picker and it seems to change the date while getting the date for the UTC timezone. The current date is the one which is encircled in the calendar. Is there any way to resolve the issue? The date range picker should show the correct date despite of the timezones.

One solution for the problem would be to change the current date manually, and I tried looking in the source code for the Datepicker but dont seem to find a method for this. Can the current date of Material Date Range picker be changed?

I am initialising the date picker as:

MaterialDatePicker.Builder builder = MaterialDatePicker.Builder.dateRangePicker();
final MaterialDatePicker materialDatePicker = builder.build();
materialDatePicker.show(fragmentManager, materialDatePicker.toString());

Kindly help.

It is fixed in the last release:

https://github.com/material-components/material-components-android/releases/tag/1.2.0-rc01

Fixed issue that caused highlighting the wrong day as today -> commit

The above issue was resolved. Kindly refer to this comment .

I have updated the library to: material:1.3.0-alpha02 and it helped me.

Tried 1.4.0. It is working fine

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM