taltstidl / AppCompat-Extension-Library

A library that builds on the AppCompat Design Library and provides additional common components such as AccountHeaderView, FloatingActionMenu, CircleImageView, Picker Dialogs, FlexibleToolbarLayout, Delightful Detail Drawables and TypefaceCompat.
Apache License 2.0
304 stars 42 forks source link

Date select Is not correct #24

Closed Greathfs closed 7 years ago

Greathfs commented 7 years ago

public void onDateSet(AppCompatDatePicker view, int year, int month, int day) { // Do something with the date chosen by the user Toast.makeText(getContext(), "year="+year+"month="+month+"day="+day, Toast.LENGTH_SHORT).show(); }

The month is not corrent.For example,the current month is12,it will show 11.

taltstidl commented 7 years ago

@Greathfs This is the same behavior as the stock DatePickerDialog that Android provides. Months are index-based, that is, the months in the year are 0 (January) through 11 (December). I'm aware that this is not exactly intuitive, but I wanted to emulate the stock behavior. If you want the months to start with 1 for January, just add 1 to the month.

Greathfs commented 7 years ago

Thanks for your answer.I tried it just now,and it worked.Thanks again.