pub(super) fn is_in_range(
    date: &DateTime,
    start: &Option<DateTime>,
    end: &Option<DateTime>,
    inclusive: bool,
) -> bool {
    // Should it include or not include the start and/or end date?
    if inclusive {
        match (start, end) {
            (Some(start), Some(end)) => (start..=end).contains(&date),
            (Some(start), None) => (start..).contains(&date),
            (None, Some(end)) => (..=end).contains(&date),
            (None, None) => true,
        }
    } else {
        match (start, end) {
            (Some(start), Some(end)) => (Excluded(start), Excluded(end)).contains(date),
            (Some(start), None) => (Excluded(start), Unbounded).contains(date),
            (None, Some(end)) => (Unbounded, Excluded(end)).contains(date),
            (None, None) => true,
        }
    }
}
/// Helper function to determine if a date is within a given range.
Helper function to determine if a date is within a given range.
Helper function to determine if a date is within a given range .
pub(super) fn is_in_range(
    date: &DateTime,
    start: &Option<DateTime>,
    end: &Option<DateTime>,
    inclusive: bool,
) -> bool {
    // Should it include or not include the start and/or end date?
    if inclusive {
        match (start, end) {
            (Some(start), Some(end)) => (start..=end).contains(&date),
            (Some(start), None) => (start..).contains(&date),
            (None, Some(end)) => (..=end).contains(&date),
            (None, None) => true,
        }
    } else {
        match (start, end) {
            (Some(start), Some(end)) => (Excluded(start), Excluded(end)).contains(date),
            (Some(start), None) => (Excluded(start), Unbounded).contains(date),
            (None, Some(end)) => (Unbounded, Excluded(end)).contains(date),
            (None, None) => true,
        }
    }
}
pub ( super ) fn is_in_range ( date : & DateTime , start : & Option < DateTime > , end : & Option < DateTime > , inclusive : bool , ) -> bool { // Should it include or not include the start and/or end date? if inclusive { match ( start , end ) { ( Some ( start ) , Some ( end ) ) => ( start ..= end ) . contains ( & date ) , ( Some ( start ) , None ) => ( start .. ) . contains ( & date ) , ( None , Some ( end ) ) => ( .. = end ) . contains ( & date ) , ( None , None ) => true , } } else { match ( start , end ) { ( Some ( start ) , Some ( end ) ) => ( Excluded ( start ) , Excluded ( end ) ) . contains ( date ) , ( Some ( start ) , None ) => ( Excluded ( start ) , Unbounded ) . contains ( date ) , ( None , Some ( end ) ) => ( Unbounded , Excluded ( end ) ) . contains ( date ) , ( None , None ) => true , } } }
Helper function to determine if a date is within a given range.
Helper function to determine if a date is within a given range .
date
&DateTime
start
&Option<DateTime>
end
&Option<DateTime>
inclusive
bool
date
&DateTime
start
&Option<DateTime>
end
&Option<DateTime>
inclusive
bool