Compare commits

3 Commits

Author SHA1 Message Date
Ian Roddis
27fed674b2 Fixing dead code, adding more data to manifest 2021-12-08 14:33:52 -04:00
Ian Roddis
e37ba5fd05 Updating manifest with more information 2021-12-08 14:19:37 -04:00
Ian Roddis
6166c6d664 Squashed commit of the following:
commit 3fd1474140
Author: Ian Roddis <tech@kinesin.ca>
Date:   Wed Dec 8 14:01:28 2021 -0400

    Adding license and adjusting readme

commit 638659a467
Author: Ian Roddis <tech@kinesin.ca>
Date:   Wed Dec 8 13:55:40 2021 -0400

    Adding support for generating date ranges on date ranges
2021-12-08 14:04:28 -04:00
2 changed files with 7 additions and 2 deletions

View File

@@ -3,6 +3,10 @@ name = "flexcal"
version = "0.1.0"
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

View File

@@ -180,7 +180,7 @@ impl DateSpec {
}
}
fn default_dow_set() -> HashSet<Weekday> {
pub fn default_dow_set() -> HashSet<Weekday> {
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),