Home

Awesome

PersianDatePicker

An Android DatePicker for Persian Calendar

ScreenShot ScreenShot

Usage:

<pre><code>xmlns:persianDatePicker="http://schemas.android.com/apk/res-auto"</code></pre> <pre><code>&lt;ir.smartlab.persindatepicker.PersianDatePicker android:layout_width="wrap_content" android:layout_height="wrap_content"/&gt;</code></pre> <pre><code>&lt;declare-styleable name="PersianDatePicker"&gt; &lt;attr name="minYear" format="integer" /&gt; &lt;attr name="maxYear" format="integer" /&gt; &lt;attr name="selectedYear" format="integer" /&gt; &lt;attr name="selectedMonth" format="integer" /&gt; &lt;attr name="selectedDay" format="integer" /&gt; &lt;attr name="displayMonthNames" format="boolean" /&gt; &lt;attr name="yearRange" format="integer" /&gt; &lt;/declare-styleable&gt;</code></pre>

Params:

Examples:

<pre><code>&lt;ir.smartlab.persindatepicker.PersianDatePicker android:layout_width="wrap_content" android:layout_height="wrap_content"/&gt;</code></pre> <pre><code>&lt;ir.smartlab.persindatepicker.PersianDatePicker android:layout_width="wrap_content" android:layout_height="wrap_content" app:displayMonthNames="true" /&gt;</code></pre> <pre><code>&lt;ir.smartlab.persindatepicker.PersianDatePicker android:layout_width="wrap_content" android:layout_height="wrap_content" app:maxYear="1450" app:minYear="1350" /&gt;</code></pre>

Java Examples:

<pre><code>persianDatePicker.setDisplayDate(new Date());</code></pre> <pre><code>PersianCalendar persianCalendar = new PersianCalendar(); persianCalendar.setPersianDate(1393, 6, 28); persianDatePicker.setDisplayPersianDate(persianCalendar);</code></pre> <pre><code>Date d = persianDatePicker.getDisplayDate(); // OR PersianCalendar pCal = persianDatePicker.getDisplayPersianDate();</code></pre>

Leap Year:

In Hijri Shamsi some years are leap year, so the last month of year is 30 days (not 29 days). PersianDatePicker take cares of leap years. This means that users will never pick a wrong date.

To Do:

Credits:

PersianDatepicker is heavily based on AOSP (https://source.android.com) and persian-calendar (https://github.com/mortezaadi/persian-calendar).

Version

1.0

License

Apache License Version 2.0