holidays 0.1.0

Rust library to provide accurate and up-to-date holiday dates based on Python holidays package
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use chrono::NaiveDate;
use holidays::Country;

fn main() -> anyhow::Result<()> {
    holidays::Builder::new()
        .countries(&[Country::JP])
        .years(2022..2023)
        .init()?;

    let s = NaiveDate::from_ymd_opt(2022, 1, 1).expect("Invalid date");
    let u = NaiveDate::from_ymd_opt(2023, 1, 1).expect("Invalid date");

    for holiday in holidays::iter(Country::JP, s, u)?.map(|h| h.date) {
        println!("{holiday:?}",);
    }

    Ok(())
}