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. The design is inspired by PersianDatePicker.
Functions that are available in this library are:
- setMaxYear
- setMinYear
- setDate
- getSelectedYear
- getSelectedMonth
- getSelectedDay
- 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.1.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: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.
I will add these features in the future:
- Calculating leap years
- Converting a date to Gregorian date
PersianLinearDatePicker is released under the Apache License 2.0. See LICENSE for details.
Copyright (c) 2020 Pouya Heydari