Understanding the functionality of nextPrayer and currentPrayer
Zalanshah64 opened this issue · comments
Often, I'll find that the output of the currentPrayer and nextPrayer functions can be "none". I'm unsure of why, and was hoping somebody could explain exactly when the output would be "none" and when it could output something else.
A PrayerTimes object is only for a single day so a currentPrayer
would be none
if time for fajr has not yet begun because it does not know about the previous day's Isha. Similarly nextPrayer
would be none
if the time for isha has started since it doesn't know about tomorrow's fajr.
It is recommended to check for these values of none
and compute the previous or next day's prayer times to show the appropriate next or current prayer.
Also the currentPrayer and nextPrayer functions default to using the current date but you can also pass in a specific date for more advanced checks or for testing purposes.