Skip to content

Persian Calendar is an Android library written in Jetpack Compose that offers Persian calendar.

License

Notifications You must be signed in to change notification settings

AmirSinaRZ/PersianCalendar

Repository files navigation

Persian Calendar

An Android library built with jetpack compose - Persian calendar component. It's easy to use, quick to implement and can be customized according to your application color and theme.

Library Image

Setup

Add the JitPack repository to settings.gradle file

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        ...      
        maven { url 'https://jitpack.io' }
    }
}

Add the dependencies to app-level build.gradle file

dependencies {
    ...
    implementation 'com.github.AmirSinaRZ:PersianCalendar:1.0.0'
}

Usage

simple usage

to show persian calendar whitout any customization:

PersianCalendar { jalaliDate, localDate ->
    //do something with date here
}

localDate is java.time.LocalDate & jalaliDate is JalaliDate.kt

usage with customization:

PersianCalendar(
    modifier: Modifier = Modifier,
    colors: PersianCalendarColors = PersianCalendarDefaults.getPersianCalendarColors(),
    fontFamily: FontFamily = PersianCalendarDefaults.persianCalendarFont(),
    initDate: JalaliDate = JalaliDate(1403, 11, 1), //default is current date
    elevation: Dp = 0.dp,
    contentPadding: Dp = 5.dp,
    cornerRadius: Dp = 8.dp,
    showFullWeekDay: Boolean = false, //true: شنبه, false: ش
    animate: Boolean = true,
    animatePerItem: Boolean = true,
    animationDuration: Int = 200,
    animationDelay: Long = 30L,
) { jalaliDate, localDate ->
    // do something with date here
}

Preview

rec.mp4

Contributing

Contributions are welcome! If you find a bug or would like to create a new feature, please submit a pull request.

License

This library is licensed under the Apache-2.0 license. See LICENSE

Developed by Amirsina Razghandi