[−][src]Crate holiday
holiday
A library for defining annually repeating dates and holidays
use holiday::*; use holiday::holidays::united_states::THANKSGIVING; use chrono::{Weekday, NaiveDate}; // Pastover: First Friday in April let pastover = Holiday::new_nth("Pastover", First, Weekday::Fri, 4); assert_eq!(pastover.in_year(2021), NaiveDate::from_ymd(2021, 4, 2)); assert_eq!(pastover, NaiveDate::from_ymd(2021, 4, 2)); assert_eq!(pastover, NaiveDate::from_ymd(2022, 4, 1));
Re-exports
pub use before_after::*; |
pub use iter::*; |
pub use NthWeekday::*; |
pub use Month::*; |
Modules
before_after | BeforeAfterDate |
holidays | A selection of pre-defined holidays provided for convenience |
iter | Module provides an iterator over the annual occurrences of a |
Macros
holiday | Macro to create Holiday |
holiday_const | Macro to create a |
Structs
DayOfMonth | A fixed day of the month (e.g.: March 31) |
Holiday | An annually repeating calendar date. Can be either a fixed date (e.g., April 1) or an nth weekday of the month (e.g., 4th Thursday in November) |
NthWeekdayOfMonth | Nth weekday of a month (e.g.: Second Tuesday in October) |
Enums
HolidayDate | Holiday Date type |
Month | A convenience enum for specifiying the month (January = 1) |
NthWeekday | The nth ocurrence of a weekday in a month. |