Trait holiday::before_after::BeforeAfterDate

source ·
pub trait BeforeAfterDate {
    // Required methods
    fn after(&self, date: &NaiveDate) -> NaiveDate;
    fn before(&self, date: &NaiveDate) -> NaiveDate;

    // Provided methods
    fn after_today(&self) -> NaiveDate { ... }
    fn before_today(&self) -> NaiveDate { ... }
    fn first_date(&self) -> NaiveDate { ... }
    fn last_date(&self) -> NaiveDate { ... }
}
Expand description

Trait to determine the next and previous occurrence of dates (successor and predecessor). The next occurrence should include the current date, the previous occurrence should exclude the current date.

Required Methods§

source

fn after(&self, date: &NaiveDate) -> NaiveDate

The next occurrence after a given date

source

fn before(&self, date: &NaiveDate) -> NaiveDate

The previous occurrence before a given date

Provided Methods§

source

fn after_today(&self) -> NaiveDate

The next occurrence including today (successor)

source

fn before_today(&self) -> NaiveDate

The previous occurrence excluding today (predecessor)

source

fn first_date(&self) -> NaiveDate

The first representable occurrence of the date

source

fn last_date(&self) -> NaiveDate

The last representable occurrence of the date

Implementors§