Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Hijrah day of month: 30 #35

Open
atifaziz1 opened this issue Nov 24, 2022 · 10 comments
Open

Invalid Hijrah day of month: 30 #35

atifaziz1 opened this issue Nov 24, 2022 · 10 comments

Comments

@atifaziz1
Copy link

I am facing issue that hijrah date is invalid.. This error is exist in both version 2.0.1 and 2.0.2.

Any help.? @msarhan @alhazmy13
Screenshot 2022-11-24 at 11 31 00 AM

Error Screen shot is attached.

@alhazmy13
Copy link
Contributor

@atifaziz1 I think you are parsing the date in the wrong way; you cannot set the month to 30.
Can you share your code?

@atifaziz1
Copy link
Author

atifaziz1 commented Nov 24, 2022

@alhazmy13 Thanks for your quick response.

Here is my code

UmmalquraCalendar now = new UmmalquraCalendar();

HijriDatePickerDialog hijriDatePickerDialog = HijriDatePickerDialog.newInstance(listener,now.get(UmmalquraCalendar.YEAR), now.get(UmmalquraCalendar.MONTH), now.get(UmmalquraCalendar.DAY_OF_MONTH));`

@atifaziz1
Copy link
Author

atifaziz1 commented Nov 24, 2022

@alhazmy13 If i do

UmmalquraCalendar now = new UmmalquraCalendar();
HijriDatePickerDialog hijriDatePickerDialog = HijriDatePickerDialog.newInstance(listener, now.get(Calendar.YEAR), now.get(Calendar.MONTH),now.get(Calendar.DAY_OF_MONTH));

I am getting com.github.msarhan.ummalqura.calendar.DateTimeException: Invalid Hijrah day of month: 31 error

@atifaziz1
Copy link
Author

@msarhan please help required. It's urgent.

@alhazmy13
Copy link
Contributor

@atifaziz1 I believe this related to HijriDatePicker it could be using an old version of UmmalquraCalendar or something like that, ill dig deep on the library to find the root case of this issue

@atifaziz1
Copy link
Author

@alhazmy13 I hope you will fix this issue on priority bases.
Thanks.

@alhazmy13
Copy link
Contributor

Yes sir @atifaziz1 , you are using the library in the wrong way, please update your code to below:

UmmalquraCalendar now = new UmmalquraCalendar();
HijriDatePickerDialog dpd = HijriDatePickerDialog.newInstance(
		  this,
		  now.get(UmmalquraCalendar.YEAR),
		  now.get(UmmalquraCalendar.MONTH),
		  now.get(UmmalquraCalendar.DAY_OF_MONTH));
dpd.show(getFragmentManager(), "HijriDatePickerDialog");

more details: https://github.com/alhazmy13/HijriDatePicker#create-a-hijridatepickerdialog

@atifaziz1
Copy link
Author

Dear @alhazmy13 !

Please look at my first comment, i am writing the code same as you mentioned.

UmmalquraCalendar now = new UmmalquraCalendar();

HijriDatePickerDialog hijriDatePickerDialog = HijriDatePickerDialog.newInstance(listener,
now.get(UmmalquraCalendar.YEAR), 
now.get(UmmalquraCalendar.MONTH),
 now.get(UmmalquraCalendar.DAY_OF_MONTH));`

@AhmedElsayedTaha
Copy link

@atifaziz1 Did you fixed it ? I'm stuck at this error

@AhmedElsayedTaha
Copy link

@msarhan @alhazmy13 Hello , I have the same exception when I choose day 30 from any month then choose day 29 from another month I get this exception . I use version 2.0.2

Here is my code

 private fun showHijriDatePicker(
        editText: TextInputEditText,
        isFromDatePicker: Boolean = false
    ) {
        val datePicker = HijriDatePickerDialog.newInstance(
            { _, year, monthOfYear, dayOfMonth ->
                when (isFromDatePicker) {
                    true -> {
                        fromDateValue = formatHijriDate(year, monthOfYear, dayOfMonth)
                    }
                    false -> {
                        toDateValue = formatHijriDate(year, monthOfYear, dayOfMonth)
                    }
                }
                editText.setText(formatHijriDate(year, monthOfYear, dayOfMonth))
            },
            ummalquraCalendar.get(UmmalquraCalendar.YEAR),
            ummalquraCalendar.get(UmmalquraCalendar.MONTH),
            ummalquraCalendar.get(UmmalquraCalendar.DAY_OF_MONTH)
        )
}

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants