msarhan / ummalqura-calendar

Implementation of java.util.Calendar for the Umm Al-Qura calendar system.
MIT License
154 stars 51 forks source link

DateTimeException when using set method #33

Open anastr opened 2 years ago

anastr commented 2 years ago

Simply trying to add/set a month or a year to the calender object when DAY_OF_MONTH is 30. It'll throw DateTimeException: Invalid Hijrah day of month: 30 because it has 29 days in the new month. Fore ex:

calendar.add(UmmalquraCalendar.MONTH, 1)
// Or using set
calendar[UmmalquraCalendar.YEAR] = 1446

This doesn't happen with Calender, it'll pick the last day of month of the new month instead.

Thanks in advance!