DateOfBirthTextInputLayout
DateOfBirthTextInputLayout is an extension of InputFormTextInputLayout
. It allows two different date formats based on the locale, dd/MM/yyyy
and MM/dd/yyyy
, formatting it as the user types. It also validates the date: checking if it exists, if it is after the current date, or if it is before 1/1/1900.
Usage
You can set it up in code or in the layout:
In code:
fun setDate(newDate: Date?)fun getDate(): Date?
In the layout:
<com.poqstudio.platform.view.account.inputform.dateofbirth.ui.DateOfBirthTextInputLayout android:id="@+id/date_of_birth_test_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:date="@={viewModel.date}" /> // It allows two-way data binding