-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
fix: dummy value used if current time 0h:0m - fajr #5
Conversation
As I mentioned before in #3 (comment), please check if my patch works for you. |
Yes. The patch contains only one commit for the second bug you described here #3 (comment). Is that patch solves your second bug? |
It still not solved yet using the patch. Using the patch, when the current time is between 0:0 until fajr time it show Error: InvalidTime. I think the use of dummy value is still nessecarry.
But the problem is fixed by changing the dummy value from Dohr to Isyaa |
Would you like to give me the reproducible test cases? Such as https://github.com/azzamsa/islam/blob/master/src/salah/times.rs#L429-L437. I will add it to the test cases. |
Finally I think I found the bug source. ranges is used to determine current_prayer
but the last item on ranges is never reach out.
So if right now is 26 Jul 2023 at 20:23 time. The current prayer is ishaa. But if the time change to 27 Jul 2023 at 01:23 time. The current prayer is not match with every item on ranges.
d: 2023-07-26T 19:06:54..**2023-07-27**T 04:42:54 -- NOT MATCH |
So my solution is to add another if case on ranges variable in current_time function
but I'm using unwrap on that solution, so I'm not sure what is the best solution |
I use this approach instead. // Special case for time after 00:00
// It never get any matching prayer in the iteration above
if current_prayer.is_none() && time < self.fajr {
current_prayer = Some(Prayer::Ishaa)
} https://github.com/azzamsa/islam/blob/master/src/salah/times.rs#L364-L368 |
Bug: current_prayer is Dohr when it should be Isyaa after midnight (0h:0m)