An easy to use Android library to pick a date.
You can set the minimum and maximum dates to be shown to the user. After user selects the desired date, you can get the year, month and day separator or joined together by any separator you like.
Also the numbers are shown in Persian by default to users.
This project is made by Kotlin and AndroidX completely and is not a forked or refactored code.
Functions that are available in this library are:
- setMaxYear
- setMinYear
- setDate
- getSelectedYear
- getSelectedMonth
- getSelectedDay
- getSelectedGregorianYear
- getSelectedGregorianMonth
- getSelectedGregorianDay
- getFormattedDate
- getPersianFormattedDate
- setOnDateChangedListener
First add maven repository to your project level gradle file:
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
Then add the dependency:
dependencies {
implementation 'com.github.SirLordPouya:PersianLinearDatePicker:1.3.0'
}
Add PersianLinearDatePicker view to your xml:
<com.pouyaheydari.lineardatepicker.PersianLinearDatePicker
android:id="@+id/datePicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:defaultDay="20"
app:defaultMonth="6"
app:defaultYear="1400"
app:maxYear="1420"
app:minYear="1320" />
Note that maxYear and minYear are optional. If you dont set any values for minYear or maxYear, 1320..1420 will be used as default values.
PersianLinearDatePicker is released under the Apache License 2.0. See LICENSE for details.
Copyright (c) 2020 Pouya Heydari