arabeyes-org / ITL

Islamic Tools and Libraries
Other
81 stars 22 forks source link

Umm Al-Qurra method does not handle Ramadan correctly #7

Closed z3bi closed 10 years ago

z3bi commented 10 years ago

The Umm Al-Qurra method currently always has a fixed interval of 90 minutes, however in Ramadan this interval is 120 minutes. I am happy to write the fix for this, but I am interested in hearing the best way to do this.

Because the hijri calendar is not fixed, this should be something in the conf. Perhaps a isRamadan flag?

ghost commented 10 years ago

Wouldn't be good if we let the app (I think this is what you meant by conf) decide when Ramadan is, then tell ITL through a flag to bump it to 120?

sgtsquiggs commented 10 years ago

I think you both have the same idea. +1

arabeyes commented 10 years ago

You can use the hijri converter of ITL to create your isRamadan function. However, for the front-end of an app, I recommend having an option to manually adjust the hijri calendar (e.g. plus or minus one day), as Islamic countries, currently, decide the first day of Ramadan using different methods or different regulations/interpretations, leading to two or more Ramadan start dates among those countries.

mohamed commented 10 years ago

I wouldn't consider this as a fix Ameir. The 120 minutes used in Ramadan is just to give extra half hour for people to eat after Maghrib. Therefore, I wouldn't consider this as a bug. Maybe "nice-to-have" feature since anyhow in Ramadan, people go Isha after hearing Athan from local mosques and not using ITL :-D

z3bi commented 10 years ago

Looking at getMethod() where the Isha interval is set, I think the best way to handle this is to have another value in the methods enum called UMM_ALQURRA_RAMADAN that sets the interval to 120. It would then be the responsiblity of the client using the library to pass in either UMM_ALQURRA or UMM_ALQURRA_RAMADAN based on its own determination of whether or not this calculation is for ramadan.

If no one has any objections, I will make a pull request for this change.

z3bi commented 10 years ago

@mohamed still, apps using ITL should reflect the prayer time in the area.