Compare commits

3 Commits

Author SHA1 Message Date
Ian Roddis
3fd1474140 Adding license and adjusting readme 2021-12-08 14:01:28 -04:00
Ian Roddis
638659a467 Adding support for generating date ranges on date ranges 2021-12-08 13:55:40 -04:00
Ian Roddis
cadb5782f0 checkpoint 2021-12-08 10:54:01 -04:00
2 changed files with 2 additions and 7 deletions

View File

@@ -3,10 +3,6 @@ name = "flexcal"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
license-file = "LICENSE.txt" 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 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -180,7 +180,7 @@ impl DateSpec {
} }
} }
pub fn default_dow_set() -> HashSet<Weekday> { fn default_dow_set() -> HashSet<Weekday> {
use Weekday::*; use Weekday::*;
HashSet::from([Mon, Tue, Wed, Thu, Fri]) 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 /// Returns true if the given date is a offday / non-business day
pub fn is_offday(&self, date: NaiveDate) -> bool { fn is_offday(&self, date: NaiveDate) -> bool {
!self.dow.contains(&date.weekday()) || self.get_special_offdays(date, date).contains(&date) !self.dow.contains(&date.weekday()) || self.get_special_offdays(date, date).contains(&date)
} }
@@ -381,7 +381,6 @@ mod tests {
}; };
assert!(cal.is_offday(NaiveDate::from_ymd(2021, 12, 25))); 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( let myrange = cal.date_range(
NaiveDate::from_ymd(2021, 12, 15), NaiveDate::from_ymd(2021, 12, 15),