diff --git a/Cargo.toml b/Cargo.toml index e7d8d58..edc8918 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,8 @@ edition = "2021" license-file = "LICENSE.txt" description = "A flexible business calendar struct" keywords = [ "calendar", "business", "scheduling" ] +repository = "https://github.com/kinesintech/flexcal" +homepage = "https://github.com/kinesintech/flexcal" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/calendar.rs b/src/calendar.rs index 3e194cb..f81b0f5 100644 --- a/src/calendar.rs +++ b/src/calendar.rs @@ -180,7 +180,7 @@ impl DateSpec { } } -fn default_dow_set() -> HashSet { +pub fn default_dow_set() -> HashSet { use Weekday::*; HashSet::from([Mon, Tue, Wed, Thu, Fri]) } @@ -282,7 +282,7 @@ impl Calendar { } /// Returns true if the given date is a offday / non-business day - fn is_offday(&self, date: NaiveDate) -> bool { + pub fn is_offday(&self, date: NaiveDate) -> bool { !self.dow.contains(&date.weekday()) || self.get_special_offdays(date, date).contains(&date) } @@ -381,6 +381,7 @@ mod tests { }; assert!(cal.is_offday(NaiveDate::from_ymd(2021, 12, 25))); + assert!(cal.is_offday(NaiveDate::from_ymd(2021, 12, 28))); let myrange = cal.date_range( NaiveDate::from_ymd(2021, 12, 15),