-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Open
Description
Is your feature request related to a problem? Please describe.
The current issue is that MaterialDatePicker is using java.util.Calendar (Java 7) as an underlying API to get UTC epoch millisecond and datetime format, and convert it to Month object where year property is retrieved from Calendar.get(Calendar.YEAR). This causes date string to always show year in Christian Era and/or B.C.E. As a Thai user, most of Thai are familiar with Buddhist Calendar (Buddhist year = Christian year + 543 e.g. 2021 = 2564), so elder users tend to not know which Christian year of their birthdate.
Describe the solution you'd like
- It would be great if we can customize or delegate how
Monthobject is created, so it does not limit to onlyjava.util.CalendarAPI, but open tojava.time.chrono.ThaiBuddhistDateororg.threeten.bp.chrono.ThaiBuddhistDate(Threeten ABP).
MaterialDatePicker.Builder
.datePicker()
.setCustomMonth(CustomMonth())open class CustomMonth(private val thaiBuddhistDate: ThaiBuddhistDate) : Month() {
override fun getYear(): Int {
return thaiBuddhistDate.getLong(ChronoField.YEAR).toInt()
}
}- Moreover, a custom date format should be a feature of
MaterialDatePickeras well.
Additional context
Example screenshots from another library (ThaiDateTimePicker - very old library)
