Amira
Amira

Reputation: 61

Date picker for hijri(islamic) calender in android?

is there a way to build a datepicker for Hijri (Islamic) calender instead of the default one?

Upvotes: 5

Views: 5706

Answers (3)

Abdulrahman Bahaml
Abdulrahman Bahaml

Reputation: 780

For anyone coming later to this question, I have developed a new hijri date picker library with Jetpack Compose:

  1. Provide Date Picker and Date Range Picker
  2. Supports direct text input with validation.
  3. Inspired by default Material 3 picker.
  4. Customizable, you can customize how the picker looks and some other properties.
  5. Uses java.time.HijrahDate class.
  6. Requries minimum sdk of 26 and java 11+

If you are interested, you can find more on Github.

Upvotes: 0

iTurki
iTurki

Reputation: 16398

You can use HijriDatePicker Library:

  • Provides Date + Time pickers.
  • Supports both Gregorian and Hijri (using ummalqura-calendar library).
  • Supports Google's Material Design.
  • And works all the way to API 16.

And for implementations for other platforms, check this awesome repo.

Upvotes: 4

lippertsjan
lippertsjan

Reputation: 309

You would have to create an own HijriDatePickerDialog. As a starting point I'd recommend the project android-betterpickers. Its purpose is to replace the Android standard date and time pickers with the better looking ones from e.g. Google Calendar.

You could extend (pull requests welcome) the project with an HijriDatePicker based upon their implementation. The package containing their pickers would be calendardatepicker.

Beware: this only solves the visualization part - the Hijri calendar probably has different dates than the Gregorian calendar. For that you'll probably need some conversion or HijriCalendar implementation but unfortunatelly I cannot recommend anything of that kind. agamov mentioned this answer which could solve that part of your question.

Upvotes: 1

Related Questions