4 stable releases
2024.0.3 | Mar 1, 2024 |
---|---|
2024.0.2 | Oct 25, 2023 |
2023.0.1 | Mar 7, 2023 |
2004.0.1 | Mar 7, 2023 |
#91 in Date and time
88KB
1.5K
SLoC
chinese_holiday
A Rust library for determining Chinese holidays. Holiday data from the Chinese Government Information Disclosure Platform. This library contains special holiday data from 2004 to 2024 and will continue to be updated annually thereafter.
Licensed under Apache 2.0.
Install
cargo add chinese_holiday
Usage
use chinese_holiday::*;
use chrono::*;
let date = NaiveDate::from_ymd_opt(2004, 1, 1).unwrap();
assert_eq!(chinese_holiday(&date), DayKind::NewYearsDayHoliday);
For more details, see:
lib.rs
:
The Chinese Holiday Library
English Version
chinese_holiday
is a Rust library for determining Chinese holidays. It can
determine whether a given date is a holiday, and the type of holiday.
Features
chrono-compatible
: Enable this feature to make the library compatible with thechrono
crate. This feature is enabled by default.
Example
The library is compatible with the chrono
,
for example:
## 中文版说明
`chinese_holiday` 是一个用于判断中国节假日的 Rust 库,可以判断给定日期是否是节假日,
以及节假日的类型。
### Features
- `chrono-compatible`: 启用此特性可以使此库与
[`chrono`](https://crates.io/crates/chrono) crate 兼容。此特性默认启用。
### 示例
```rust
本库与 chrono
crate 兼容,例如:
Dependencies
~0–455KB