A simple, robust, and highly customizable Persian (Jalali) date picker for Jetpack Compose.
- Two UI Styles: Choose between a classic Dialog or a modern Bottom Sheet with wheel selection.
- Native RTL Support: Built-in support for Right-to-Left layout direction.
- Highly Customizable: Full control over colors, fonts, and dimensions.
- Leap Year Support: Accurate Jalali calendar calculations.
- State Management: Includes
PersianDatePickerStatefor easy control and state hoisting.
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}dependencies {
implementation("com.github.AmirMousavi-Dev:Persian_Date_Picker:v1.3.0")
}A classic calendar grid view in a dialog.
import com.amirmousavi_dev.date_picker.ui.dialog.PersianDatePickerDialog
import com.amirmousavi_dev.date_picker.ui.rememberPersianDatePickerState
val datePickerState = rememberPersianDatePickerState()
Button(onClick = { datePickerState.show() }) {
Text("نمایش انتخابگر تاریخ (دیالوگ)")
}
PersianDatePickerDialog(state = datePickerState)A modern wheel-based selection system in a bottom sheet.
import com.amirmousavi_dev.date_picker.ui.bottomsheet.PersianDatePickerBottomSheet
import com.amirmousavi_dev.date_picker.ui.rememberPersianDatePickerState
val datePickerState = rememberPersianDatePickerState()
Button(onClick = { datePickerState.show() }) {
Text("نمایش انتخابگر تاریخ (باتم شیت)")
}
PersianDatePickerBottomSheet(state = datePickerState)The PersianDate object provides several useful properties:
year,month,day: Basic date components.dayName: Persian name of the day (e.g., "سهشنبه").monthName: Persian name of the month (e.g., "مهر").formattedDate: Standard string representation (e.g., "1403/07/10").fullDateName: User-friendly Persian string (e.g., "سهشنبه ۱۰ مهر").
You can customize the look and feel using DatePickerDefaults.colors():
PersianDatePickerDialog(
state = datePickerState,
colors = DatePickerDefaults.colors(
headerBackgroundColor = MaterialTheme.colorScheme.primary,
headerTextColor = MaterialTheme.colorScheme.onPrimary,
// ... more color options
),
fontFamily = myCustomFontFamily
)Copyright 2024 Amir Mousavi
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


