Skip to content

HeyPouya/PersianLinearDatePicker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

73c3c9a · Feb 5, 2020

History

34 Commits
Feb 5, 2020
Feb 5, 2020
Feb 4, 2020
Feb 5, 2020
Feb 4, 2020
Feb 4, 2020
Feb 4, 2020
Feb 4, 2020
Feb 5, 2020
Feb 4, 2020
Feb 4, 2020
Feb 4, 2020
Feb 4, 2020
Feb 4, 2020

Repository files navigation

Persian Date Picker

An easy to use Android library to pick a date.

API Build Status Codacy Badge ktlint

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.

Description

Library

This project is made by Kotlin and AndroidX completely and is not a forked or refactored code. The design is inspired by PersianDatePicker.

Current Functions

Functions that are available in this library are:

  • setMaxYear
  • setMinYear
  • setDate
  • getSelectedYear
  • getSelectedMonth
  • getSelectedDay
  • getFormattedDate
  • getPersianFormattedDate
  • setOnDateChangedListener

Usage

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.

TODO

I will add these features in the future:

  • Calculating leap years
  • Converting a date to Gregorian date

License

PersianLinearDatePicker is released under the Apache License 2.0. See LICENSE for details.

Copyright (c) 2020 Pouya Heydari

This App icon and style is designed by Amir Gerdakane