-
Notifications
You must be signed in to change notification settings - Fork 5
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
Wrong prayer times #6
Comments
@azzamsa What is the city (or coordinates) that you are using? I need those to run through a few tests for this issue and also to make sure the original library is also sound in order to narrow down the issue. |
Isn't this bug fixed in this comment
nice idea Long-Lat:Central Jakarta (https://www.mapcoordinates.net/en)
Local Prayer Times Schedule (https://www.jadwalsholat.org/)insha/salah Schedule
comparison
Using Ragib's forks, the result will be right. Please take in mind that jadwalsholat.org adds +2 minutes. so without it. Ragib's fork is absolutely close/same.
|
@azzamsa The fork itself cannot be used because it has a lot more changes that are not related to the issue; also that fork does not have any unit tests related to the issue as proof that the fix is a general fix and not associated with a specific location. That said, I am in the process getting the changes ready for this issue, along with writing tests to confirm the changes are working as expected. |
@azzamsa Please confirm the below for prayer times from the above website
|
Yes. Fajr is Shubuh, and Sunrise is Terbit |
I still get the wrong result. Now, I put all the config in one file. So it easy to reproduce. # main.rs
use salah::prelude::*;
fn main() {
let central_jakarta = Coordinates::new(-6.18233995, 106.84287154);
let date = Utc.ymd(2020, 1, 13);
let params = Configuration::with(Method::Egyptian, Madhab::Shafi);
let prayers = PrayerSchedule::new()
.on(date)
.for_location(central_jakarta)
.with_configuration(params)
.calculate();
match prayers {
Ok(prayer) => {
println!(
"{}: {}",
Prayer::Fajr.name(),
prayer.time(Prayer::Fajr).format("%-l:%M %p").to_string()
);
println!(
"{}: {}",
Prayer::Sunrise.name(),
prayer.time(Prayer::Sunrise).format("%-l:%M %p").to_string()
);
println!(
"{}: {}",
Prayer::Dhuhr.name(),
prayer.time(Prayer::Dhuhr).format("%-l:%M %p").to_string()
);
println!(
"{}: {}",
Prayer::Asr.name(),
prayer.time(Prayer::Asr).format("%-l:%M %p").to_string()
);
println!(
"{}: {}",
Prayer::Maghrib.name(),
prayer.time(Prayer::Maghrib).format("%-l:%M %p").to_string()
);
println!(
"{}: {}",
Prayer::Isha.name(),
prayer.time(Prayer::Isha).format("%-l:%M %p").to_string()
);
println!(
"{}: {}",
Prayer::Qiyam.name(),
prayer.time(Prayer::Qiyam).format("%-l:%M %p").to_string()
);
}
Err(error) => println!("Could not calculate prayer times: {}", error),
}
} ❯ cargo r
Compiling libc v0.2.77
Compiling num-traits v0.2.12
Compiling time v0.1.44
Compiling num-integer v0.1.43
Compiling chrono v0.4.18
Compiling salah v0.5.0 (/bilal-project/insha-salah)
Compiling bilal v0.1.5 (/bilal-project/bilal)
Finished dev [unoptimized + debuginfo] target(s) in 2.59s
Running `target/debug/bilal`
Fajr: 9:26 PM
Sunrise: 10:47 PM
Dhuhr: 5:02 AM
Asr: 8:27 AM
Maghrib: 11:15 AM
Isha: 12:27 PM
Qiyam: 6:02 PM Why fajr is 9:26 PM, the correct one is around ~04:15 AM. Am I missing something? |
@azzamsa Yes, you are missing the bit in the readme about the output being in UTC. The library only returns times in UTC, therefore, all clients will need to take the UTC time and convert it to the appropriate local time. You can take a look at the unit test, |
Since Ragib's fork is not active anymore. I try to revert all my changes to use
insha/salah
. Hoping that it will be fixed here.But if you see, with the same config as Ragib's fork. I got very different result. Which is not quite right compared to my city prayer schedule.
My city schedule:
The time for fajr is
12:55 AM
, which the correct one is03:54 AM
The text was updated successfully, but these errors were encountered: