Skip to main content

prayer_times/
prayer-times.rs

1use chrono::Local;
2use mawaqit::prelude::*;
3
4fn main() {
5    let prayers = PrayerSchedule::new()
6        .on(NaiveDate::from_ymd_opt(2026, 6, 21).expect("invalid date"))
7        .for_location(Coordinates::new(50.85, 4.35)) // Brussels
8        .with_configuration(Configuration::with(
9            Method::MuslimWorldLeague,
10            Madhab::Shafi,
11        ))
12        .calculate()
13        .expect("prayer times calculation failed");
14
15    println!("Prayer times for Brussels on 2026-06-21:");
16    for prayer in &[
17        Prayer::Fajr,
18        Prayer::Sunrise,
19        Prayer::Dhuhr,
20        Prayer::Asr,
21        Prayer::Maghrib,
22        Prayer::Isha,
23    ] {
24        let local = prayers.time(*prayer).with_timezone(&Local);
25        println!("  {prayer:>8?}  {}", local.format("%H:%M"));
26    }
27}