Crates.io | holiday_jp |
lib.rs | holiday_jp |
version | 0.1.2 |
source | src |
created_at | 2017-11-07 23:48:51.483579 |
updated_at | 2017-11-08 00:09:31.618598 |
description | holiday_jp |
homepage | |
repository | https://github.com/atsushi130/holiday-jp |
max_upload_size | |
id | 38539 |
size | 22,220 |
[dependencies]
holiday_jp = "0.1.2"
extern crate holiday_jp;
extern crate chrono;
use holiday_jp::HolidayService;
use chrono::Local;
fn main() {
let date = Local::now();
if HolidayService.is_holiday(date) {
println!("today is a holiday!");
}
}
HolidayService API
fn is_holiday(&self, date: DateTime<Local>) -> bool;
fn is_weekend(&self, date: DateTime<Local>) -> bool;
fn is_public_holiday(&self, date: DateTime<Local>) -> bool;
fn is_beginning_of_the_year(&self, date: DateTime<Local>) -> bool;
DateTimeToString trait
use holiday_jp::DateTimeToString;
let date_time_string = Local::now().to_format_string();
This project is dual-licensed under MIT and Apache 2.0.