Skip to content

holiday-jp/holiday_jp-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

holiday_jp-rust

Build Status

Get holidays in Japan.

Install

[dependencies]
holiday_jp = { git = "https://github.com/holiday-jp/holiday_jp-rust", tag = "0.3.0" }
time = "0.3.28"

Already holiday_jp crate was reserved. We need to specify github repository for now.

Usage

use holiday_jp::HolidayJp;
use time::{Date, Month};

fn main() {
    let from_date = Date::from_calendar_date(2010, Month::September, 14).unwrap();
    let to_date = Date::from_calendar_date(2010, Month::September, 21).unwrap();
    let holidays = HolidayJp::between(from_date, to_date);
    println!("{}", holidays.first().unwrap().name); // 敬老の日

    let date = Date::from_calendar_date(2016, Month::August, 11).unwrap();
    println!("{}", HolidayJp::is_holiday(date)); // true
}

See examples/basic.rs and run it with cargo run --example basic.

Difference of original holiday_jp crate

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages