diff --git a/Cargo.toml b/Cargo.toml index fd5d751..358e71f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,4 +16,4 @@ license = "MIT" spectral = "0.6.0" [dependencies] -chrono = "0.4.6" +chrono = "0.4.38" diff --git a/src/astronomy/solar.rs b/src/astronomy/solar.rs index f95ec36..e49bf43 100644 --- a/src/astronomy/solar.rs +++ b/src/astronomy/solar.rs @@ -97,8 +97,9 @@ impl SolarTime { pub fn new(date: DateTime, coordinates: Coordinates) -> SolarTime { // All calculation need to occur at 0h0m UTC let today = Utc - .ymd(date.year(), date.month(), date.day()) - .and_hms(0, 0, 0); + .with_ymd_and_hms(date.year(), date.month(), date.day(), 0, 0, 0) + .single() + .expect("Invalid date received."); let tomorrow = today.tomorrow(); let yesterday = today.yesterday(); let prev_solar = SolarCoordinates::new(yesterday.julian_day()); @@ -186,8 +187,6 @@ impl SolarTime { } fn setting_hour(value: f64, date: &DateTime) -> Option> { - let mut adjusted_time: Option> = None; - if value.is_normal() { let calculated_hours = value.floor(); let calculated_minutes = ((value - calculated_hours) * 60.0).floor(); @@ -202,19 +201,20 @@ impl SolarTime { let adjusted_secs: u32 = 0; let adjusted = Utc - .ymd( + .with_ymd_and_hms( adjusted_date.year(), adjusted_date.month(), adjusted_date.day(), + hour, + mins, + secs, ) - .and_hms(adjusted_hour, adjusted_mins, adjusted_secs); + .single(); - adjusted_time = Some(adjusted); + adjusted } else { - // Nothing to do. + None } - - adjusted_time } fn hour_adjustment(calculated_hours: f64, date: &DateTime) -> (u32, DateTime) { @@ -250,17 +250,23 @@ mod tests { #[test] fn zero_out_time_for_a_date() { // Local date below is 2019-01-11T04:41:19Z in UTC - let utc_date = Utc.ymd(2019, 1, 11).and_hms(23, 41, 19); + let utc_date = Utc + .with_ymd_and_hms(2019, 1, 11, 23, 41, 19) + .single() + .expect("Invalid date and time provided"); let updated = Utc - .ymd(utc_date.year(), utc_date.month(), utc_date.day()) - .and_hms(0, 0, 0); + .with_ymd_and_hms(utc_date.year(), utc_date.month(), utc_date.day(), 0, 0, 0) + .single(); - assert_eq!(updated, Utc.ymd(2019, 1, 11).and_hms(0, 0, 0)); + assert_eq!(updated, Utc.with_ymd_and_hms(2019, 1, 11, 0, 0, 0).single()); } #[test] fn calculate_date_for_tomorrow() { - let date = Local.ymd(2019, 1, 10).and_hms(0, 0, 0); + let date = Local + .with_ymd_and_hms(2019, 1, 10, 0, 0, 0) + .single() + .expect("Invalid date and time provided"); let tomorrow = date.tomorrow(); assert_eq!(tomorrow.year(), 2019); @@ -270,7 +276,10 @@ mod tests { #[test] fn calculate_julian_date() { - let local = Local.ymd(1992, 10, 13).and_hms(0, 0, 0); + let local = Local + .with_ymd_and_hms(1992, 10, 13, 0, 0, 0) + .single() + .expect("Invalid data and time provided"); let utc = local.with_timezone(&Utc); let julian_day = ops::julian_day(1992, 10, 13, 0.0); @@ -280,11 +289,14 @@ mod tests { #[test] fn calculate_solar_time() { let coordinates = Coordinates::new(35.0 + 47.0 / 60.0, -78.0 - 39.0 / 60.0); - let date = Utc.ymd(2015, 7, 12).and_hms(0, 0, 0); + let date = Utc + .with_ymd_and_hms(2015, 7, 12, 0, 0, 0) + .single() + .expect("Invalid date and time provided"); let solar = SolarTime::new(date, coordinates); - let transit_date = Utc.ymd(2015, 07, 12).and_hms(17, 20, 0); - let sunrise_date = Utc.ymd(2015, 07, 12).and_hms(10, 08, 0); - let sunset_date = Utc.ymd(2015, 07, 13).and_hms(00, 32, 0); + let transit_date = Utc.with_ymd_and_hms(2015, 07, 12, 17, 20, 0).unwrap(); + let sunrise_date = Utc.with_ymd_and_hms(2015, 07, 12, 10, 08, 0).unwrap(); + let sunset_date = Utc.with_ymd_and_hms(2015, 07, 13, 00, 32, 0).unwrap(); assert_eq!(solar.transit, transit_date); assert_eq!(solar.sunrise, sunrise_date); @@ -294,7 +306,10 @@ mod tests { #[test] fn calculate_time_for_solar_angle() { let coordinates = Coordinates::new(35.0 + 47.0 / 60.0, -78.0 - 39.0 / 60.0); - let date = Utc.ymd(2015, 7, 12).and_hms(0, 0, 0); + let date = Utc + .with_ymd_and_hms(2015, 7, 12, 0, 0, 0) + .single() + .expect("Invalida date and time provided"); let solar = SolarTime::new(date, coordinates); let angle = Angle::new(-6.0); let twilight_start = solar.time_for_solar_angle(angle, false); @@ -307,10 +322,14 @@ mod tests { #[test] fn calculate_corrected_hour_angle() { let coordinates = Coordinates::new(35.0 + 47.0 / 60.0, -78.0 - 39.0 / 60.0); - let date = Utc.ymd(2015, 7, 12).and_hms(0, 0, 0); + let date = Utc + .with_ymd_and_hms(2015, 7, 12, 0, 0, 0) + .single() + .expect("Invalid date and time provided"); let today = Utc - .ymd(date.year(), date.month(), date.day()) - .and_hms(0, 0, 0); + .with_ymd_and_hms(date.year(), date.month(), date.day(), 0, 0, 0) + .single() + .expect("Invalid date and time provided."); let tomorrow = today.tomorrow(); let yesterday = today.yesterday(); let prev_solar = SolarCoordinates::new(yesterday.julian_day()); diff --git a/src/astronomy/unit.rs b/src/astronomy/unit.rs index bcd93bf..2c8c9eb 100644 --- a/src/astronomy/unit.rs +++ b/src/astronomy/unit.rs @@ -28,7 +28,7 @@ pub trait Stride { fn julian_day(&self) -> f64; fn adjust_time(&self, minutes: i64) -> Self; fn next_date(&self, fwd: bool) -> Self; - fn rounded_minute(&self, rounding: Rounding) -> Self; + fn rounded_minute(&self, rounding: Rounding) -> Self; } impl Stride for DateTime { @@ -52,29 +52,29 @@ impl Stride for DateTime { ) } - fn rounded_minute(&self, rounding: Rounding) -> Self { - let adjusted = self.clone(); - let seconds = adjusted.second(); - - match rounding { - Rounding::Nearest => { - let rounded = ((seconds as f64)/60.0).round() as i64; - let adjusted_seconds = seconds as i64; - - if rounded == 1 { - adjusted + Duration::seconds(60 - adjusted_seconds) - } else { - adjusted + Duration::seconds(adjusted_seconds * -1) - } - }, - Rounding::Up => { - let adjusted_seconds = seconds as i64; - - adjusted + Duration::seconds(60 - adjusted_seconds) - }, - Rounding::None => adjusted, - } - } + fn rounded_minute(&self, rounding: Rounding) -> Self { + let adjusted = self.clone(); + let seconds = adjusted.second(); + + match rounding { + Rounding::Nearest => { + let rounded = ((seconds as f64) / 60.0).round() as i64; + let adjusted_seconds = seconds as i64; + + if rounded == 1 { + adjusted + Duration::seconds(60 - adjusted_seconds) + } else { + adjusted + Duration::seconds(adjusted_seconds * -1) + } + } + Rounding::Up => { + let adjusted_seconds = seconds as i64; + + adjusted + Duration::seconds(60 - adjusted_seconds) + } + Rounding::None => adjusted, + } + } fn adjust_time(&self, minutes: i64) -> Self { let some_date = self.clone(); @@ -287,26 +287,49 @@ mod tests { assert_eq!((angle_a + angle_b).degrees, 90.0); } - - #[test] - fn calculate_rounding_nearest() { - let time_1 = Utc.ymd(2015, 7, 13).and_hms(4, 37, 30); - - assert_eq!(time_1.rounded_minute(Rounding::Nearest), Utc.ymd(2015, 7, 13).and_hms(4, 38, 00)); - } - - #[test] - fn calculate_rounding_up() { - let time_1 = Utc.ymd(2015, 07, 13).and_hms(05, 59, 20); - - assert_eq!(time_1.rounded_minute(Rounding::Up), Utc.ymd(2015, 7, 13).and_hms(6, 00, 00)); - } - - #[test] - fn calculate_rounding_none() { - let time_1 = Utc.ymd(2015, 07, 13).and_hms(05, 59, 20); - - assert_eq!(time_1.rounded_minute(Rounding::None), Utc.ymd(2015, 7, 13).and_hms(5, 59, 20)); - } - + + #[test] + fn calculate_rounding_nearest() { + let time_1 = Utc + .with_ymd_and_hms(2015, 7, 13, 4, 37, 30) + .single() + .expect("Invalid date and time."); + + assert_eq!( + time_1.rounded_minute(Rounding::Nearest), + Utc.with_ymd_and_hms(2015, 7, 13, 4, 38, 00) + .single() + .unwrap() + ); + } + + #[test] + fn calculate_rounding_up() { + let time_1 = Utc + .with_ymd_and_hms(2015, 07, 13, 05, 59, 20) + .single() + .expect("Invalid date and time."); + + assert_eq!( + time_1.rounded_minute(Rounding::Up), + Utc.with_ymd_and_hms(2015, 7, 13, 6, 00, 00) + .single() + .unwrap() + ); + } + + #[test] + fn calculate_rounding_none() { + let time_1 = Utc + .with_ymd_and_hms(2015, 07, 13, 05, 59, 20) + .single() + .expect("Invalid date and time."); + + assert_eq!( + time_1.rounded_minute(Rounding::None), + Utc.with_ymd_and_hms(2015, 7, 13, 5, 59, 20) + .single() + .unwrap() + ); + } } diff --git a/src/lib.rs b/src/lib.rs index 91dbf18..6376458 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,7 +14,7 @@ //! use salah::prelude::*; //! //! let new_york_city = Coordinates::new(40.7128, -74.0059); -//! let date = Utc.ymd(2019, 1, 25); +//! let date = NaiveDate::from_ymd_opt(2019, 1, 25).expect("Invalid date provided"); //! let params = Configuration::with(Method::NorthAmerica, Madhab::Hanafi); //! let prayers = PrayerSchedule::new() //! .on(date) @@ -34,7 +34,7 @@ pub use crate::models::method::Method; pub use crate::models::parameters::{Configuration, Parameters}; pub use crate::models::prayer::Prayer; pub use crate::schedule::{PrayerSchedule, PrayerTimes}; -pub use chrono::{Date, DateTime, Datelike, Duration, Local, TimeZone, Timelike, Utc}; +pub use chrono::{DateTime, Datelike, Duration, Local, NaiveDate, TimeZone, Timelike, Utc}; /// A convenience module appropriate for glob imports (`use salah::prelude::*;`). pub mod prelude { @@ -55,7 +55,7 @@ pub mod prelude { #[doc(no_inline)] pub use crate::schedule::{PrayerSchedule, PrayerTimes}; #[doc(no_inline)] - pub use chrono::{Date, DateTime, Datelike, Duration, Local, TimeZone, Timelike, Utc}; + pub use chrono::{DateTime, Datelike, Duration, Local, NaiveDate, TimeZone, Timelike, Utc}; } #[cfg(test)] @@ -66,7 +66,7 @@ mod tests { #[test] fn calculate_prayer_times() { - let local_date = Utc.ymd(2015, 7, 12); + let local_date = NaiveDate::from_ymd_opt(2015, 7, 12).expect("Invalid date provided"); let params = Configuration::with(Method::NorthAmerica, Madhab::Hanafi); let coordinates = Coordinates::new(35.7750, -78.6336); let schedule = PrayerTimes::new(local_date, coordinates, params); @@ -105,7 +105,7 @@ mod tests { #[test] fn calculate_times_using_the_builder_successfully() { - let date = Utc.ymd(2015, 7, 12); + let date = NaiveDate::from_ymd_opt(2015, 7, 12).expect("Invalid date provided"); let params = Configuration::with(Method::NorthAmerica, Madhab::Hanafi); let coordinates = Coordinates::new(35.7750, -78.6336); let result = PrayerSchedule::new() @@ -154,7 +154,7 @@ mod tests { #[test] fn calculate_times_using_the_builder_failure() { - let date = Utc.ymd(2015, 7, 12); + let date = NaiveDate::from_ymd_opt(2015, 7, 12).expect("Invalid date provided"); let params = Configuration::with(Method::NorthAmerica, Madhab::Hanafi); let result = PrayerSchedule::new() .on(date) @@ -169,7 +169,7 @@ mod tests { #[test] fn calculate_qiyam_times() { - let date = Utc.ymd(2015, 7, 12); + let date = NaiveDate::from_ymd_opt(2015, 7, 12).expect("Invalid date provided"); let params = Configuration::with(Method::NorthAmerica, Madhab::Hanafi); let coordinates = Coordinates::new(35.7750, -78.6336); let result = PrayerSchedule::new() @@ -207,7 +207,7 @@ mod tests { params.high_latitude_rule = HighLatitudeRule::MiddleOfTheNight; let result = PrayerSchedule::new() - .on(Utc.ymd(2021, 1, 13)) + .on(NaiveDate::from_ymd_opt(2021, 1, 13).expect("Invalid date provided")) .for_location(Coordinates::new(1.370844612058886, 103.80145644060552)) .with_configuration(params) .calculate(); @@ -215,7 +215,7 @@ mod tests { match result { Ok(schedule) => { let hour = 3600; - let sgt_offset = FixedOffset::east(8 * hour); + let sgt_offset = FixedOffset::east_opt(8 * hour).expect("Invalid offset provided"); let sgt_fajr = schedule.time(Prayer::Fajr).with_timezone(&sgt_offset); let sgt_sunrise = schedule.time(Prayer::Sunrise).with_timezone(&sgt_offset); let sgt_dhuhr = schedule.time(Prayer::Dhuhr).with_timezone(&sgt_offset); @@ -256,7 +256,7 @@ mod tests { .done(); let result = PrayerSchedule::new() - .on(Utc.ymd(2021, 1, 12)) + .on(NaiveDate::from_ymd_opt(2021, 1, 12).expect("Invalid date provided")) .for_location(Coordinates::new(-6.18233995, 106.84287154)) .with_configuration(params) .calculate(); @@ -264,7 +264,7 @@ mod tests { match result { Ok(schedule) => { let hour = 3600; - let wib_offset = FixedOffset::east(7 * hour); + let wib_offset = FixedOffset::east_opt(7 * hour).expect("Invalid offset provided"); let wib_fajr = schedule.time(Prayer::Fajr).with_timezone(&wib_offset); let wib_sunrise = schedule.time(Prayer::Sunrise).with_timezone(&wib_offset); let wib_dhuhr = schedule.time(Prayer::Dhuhr).with_timezone(&wib_offset); diff --git a/src/schedule.rs b/src/schedule.rs index ba006d9..cb60e08 100644 --- a/src/schedule.rs +++ b/src/schedule.rs @@ -9,7 +9,7 @@ //! This module provides the main objects that are used for calculating //! the prayer times. -use chrono::{Date, DateTime, Datelike, Duration, Utc}; +use chrono::{DateTime, Datelike, Duration, NaiveDate, Utc}; use crate::astronomy::ops; use crate::astronomy::solar::SolarTime; @@ -38,8 +38,11 @@ pub struct PrayerTimes { } impl PrayerTimes { - pub fn new(date: Date, coordinates: Coordinates, parameters: Parameters) -> PrayerTimes { - let prayer_date = date.and_hms(0, 0, 0); + pub fn new(date: NaiveDate, coordinates: Coordinates, parameters: Parameters) -> PrayerTimes { + let prayer_date = date + .and_hms_opt(0, 0, 0) + .expect("Invalid date provided") + .and_utc(); let tomorrow = prayer_date.tomorrow(); let solar_time = SolarTime::new(prayer_date, coordinates); let solar_time_tomorrow = SolarTime::new(tomorrow, coordinates); @@ -51,23 +54,26 @@ impl PrayerTimes { let final_fajr = PrayerTimes::calculate_fajr(parameters, solar_time, night, coordinates, prayer_date) - .rounded_minute(parameters.rounding); + .rounded_minute(parameters.rounding); let final_sunrise = solar_time .sunrise .adjust_time(parameters.time_adjustments(Prayer::Sunrise)) - .rounded_minute(parameters.rounding); + .rounded_minute(parameters.rounding); let final_dhuhr = solar_time .transit .adjust_time(parameters.time_adjustments(Prayer::Dhuhr)) - .rounded_minute(parameters.rounding); - let final_asr = asr.adjust_time(parameters.time_adjustments(Prayer::Asr)) - .rounded_minute(parameters.rounding); + .rounded_minute(parameters.rounding); + let final_asr = asr + .adjust_time(parameters.time_adjustments(Prayer::Asr)) + .rounded_minute(parameters.rounding); let final_maghrib = ops::adjust_time( &solar_time.sunset, - parameters.time_adjustments(Prayer::Maghrib)).rounded_minute(parameters.rounding); + parameters.time_adjustments(Prayer::Maghrib), + ) + .rounded_minute(parameters.rounding); let final_isha = PrayerTimes::calculate_isha(parameters, solar_time, night, coordinates, prayer_date) - .rounded_minute(parameters.rounding); + .rounded_minute(parameters.rounding); // Calculate the middle of the night and qiyam times let (final_middle_of_night, final_qiyam, final_fajr_tomorrow) = @@ -303,7 +309,7 @@ impl PrayerTimes { /// A builder for the [PrayerTimes](struct.PrayerTimes.html) struct. pub struct PrayerSchedule { - date: Option>, + date: Option, coordinates: Option, params: Option, } @@ -317,7 +323,7 @@ impl PrayerSchedule { } } - pub fn on<'a>(&'a mut self, date: Date) -> &'a mut PrayerSchedule { + pub fn on<'a>(&'a mut self, date: NaiveDate) -> &'a mut PrayerSchedule { self.date = Some(date); self } @@ -352,16 +358,16 @@ mod tests { use super::*; use crate::models::madhab::Madhab; use crate::Configuration; - use chrono::{TimeZone, Utc}; + use chrono::{NaiveDate, TimeZone, Utc}; #[test] fn current_prayer_should_be_fajr() { // Given the above DateTime, the Fajr prayer is at 2015-07-12T08:42:00Z - let local_date = Utc.ymd(2015, 7, 12); + let local_date = NaiveDate::from_ymd_opt(2015, 7, 12).expect("Invalid date provided"); let params = Configuration::with(Method::NorthAmerica, Madhab::Hanafi); let coordinates = Coordinates::new(35.7750, -78.6336); let times = PrayerTimes::new(local_date, coordinates, params); - let current_prayer_time = local_date.with_timezone(&Utc).and_hms(9, 0, 0); + let current_prayer_time = local_date.and_hms_opt(9, 0, 0).unwrap().and_utc(); assert_eq!(times.current_time(current_prayer_time), Some(Prayer::Fajr)); } @@ -369,11 +375,11 @@ mod tests { #[test] fn current_prayer_should_be_sunrise() { // Given the below DateTime, sunrise is at 2015-07-12T10:08:00Z - let local_date = Utc.ymd(2015, 7, 12); + let local_date = NaiveDate::from_ymd_opt(2015, 7, 12).expect("Invalid date provided"); let params = Configuration::with(Method::NorthAmerica, Madhab::Hanafi); let coordinates = Coordinates::new(35.7750, -78.6336); let times = PrayerTimes::new(local_date, coordinates, params); - let current_prayer_time = local_date.with_timezone(&Utc).and_hms(11, 0, 0); + let current_prayer_time = local_date.and_hms_opt(11, 0, 0).unwrap().and_utc(); assert_eq!( times.current_time(current_prayer_time), @@ -384,11 +390,11 @@ mod tests { #[test] fn current_prayer_should_be_dhuhr() { // Given the above DateTime, dhuhr prayer is at 2015-07-12T17:21:00Z - let local_date = Utc.ymd(2015, 7, 12); + let local_date = NaiveDate::from_ymd_opt(2015, 7, 12).expect("Invalid date provided"); let params = Configuration::with(Method::NorthAmerica, Madhab::Hanafi); let coordinates = Coordinates::new(35.7750, -78.6336); let times = PrayerTimes::new(local_date, coordinates, params); - let current_prayer_time = local_date.with_timezone(&Utc).and_hms(19, 0, 0); + let current_prayer_time = local_date.and_hms_opt(19, 0, 0).unwrap().and_utc(); assert_eq!(times.current_time(current_prayer_time), Some(Prayer::Dhuhr)); } @@ -396,11 +402,11 @@ mod tests { #[test] fn current_prayer_should_be_asr() { // Given the below DateTime, asr is at 2015-07-12T22:22:00Z - let local_date = Utc.ymd(2015, 7, 12); + let local_date = NaiveDate::from_ymd_opt(2015, 7, 12).expect("Invalid date provided"); let params = Configuration::with(Method::NorthAmerica, Madhab::Hanafi); let coordinates = Coordinates::new(35.7750, -78.6336); let times = PrayerTimes::new(local_date, coordinates, params); - let current_prayer_time = local_date.with_timezone(&Utc).and_hms(22, 26, 0); + let current_prayer_time = local_date.and_hms_opt(22, 26, 0).unwrap().and_utc(); assert_eq!(times.current_time(current_prayer_time), Some(Prayer::Asr)); } @@ -408,11 +414,11 @@ mod tests { #[test] fn current_prayer_should_be_maghrib() { // Given the below DateTime, maghrib is at 2015-07-13T00:32:00Z - let local_date = Utc.ymd(2015, 7, 12); + let local_date = NaiveDate::from_ymd_opt(2015, 7, 12).expect("Invalid data provided"); let params = Configuration::with(Method::NorthAmerica, Madhab::Hanafi); let coordinates = Coordinates::new(35.7750, -78.6336); let times = PrayerTimes::new(local_date, coordinates, params); - let current_prayer_time = Utc.ymd(2015, 7, 13).and_hms(01, 0, 0); + let current_prayer_time = Utc.with_ymd_and_hms(2015, 7, 13, 01, 0, 0).unwrap(); assert_eq!( times.current_time(current_prayer_time), @@ -423,29 +429,29 @@ mod tests { #[test] fn current_prayer_should_be_isha() { // Given the below DateTime, isha is at 2015-07-13T01:57:00Z - let local_date = Utc.ymd(2015, 7, 12); + let local_date = NaiveDate::from_ymd_opt(2015, 7, 12).expect("Invalid date provided"); let params = Configuration::with(Method::NorthAmerica, Madhab::Hanafi); let coordinates = Coordinates::new(35.7750, -78.6336); let times = PrayerTimes::new(local_date, coordinates, params); - let current_prayer_time = Utc.ymd(2015, 7, 13).and_hms(02, 0, 0); + let current_prayer_time = Utc.with_ymd_and_hms(2015, 7, 13, 02, 0, 0).unwrap(); assert_eq!(times.current_time(current_prayer_time), Some(Prayer::Isha)); } #[test] fn current_prayer_should_be_none() { - let local_date = Utc.ymd(2015, 7, 12); + let local_date = NaiveDate::from_ymd_opt(2015, 7, 12).expect("Invalid data provided"); let params = Configuration::with(Method::NorthAmerica, Madhab::Hanafi); let coordinates = Coordinates::new(35.7750, -78.6336); let times = PrayerTimes::new(local_date, coordinates, params); - let current_prayer_time = local_date.with_timezone(&Utc).and_hms(8, 0, 0); + let current_prayer_time = local_date.and_hms_opt(8, 0, 0).unwrap().and_utc(); assert_eq!(times.current_time(current_prayer_time), None); } #[test] fn calculate_times_for_moonsighting_method() { - let date = Utc.ymd(2016, 1, 31); + let date = NaiveDate::from_ymd_opt(2016, 1, 31).expect("Invalid date provided"); let params = Configuration::with(Method::MoonsightingCommittee, Madhab::Shafi); let coordinates = Coordinates::new(35.7750, -78.6336); let result = PrayerSchedule::new() @@ -500,7 +506,7 @@ mod tests { #[test] fn calculate_times_for_moonsighting_method_with_high_latitude() { - let date = Utc.ymd(2016, 1, 1); + let date = NaiveDate::from_ymd_opt(2016, 1, 1).expect("Invalid date provided"); let params = Configuration::with(Method::MoonsightingCommittee, Madhab::Hanafi); let coordinates = Coordinates::new(59.9094, 10.7349); let result = PrayerSchedule::new()