nongli

Crates.ionongli
lib.rsnongli
version0.1.1
sourcesrc
created_at2023-10-30 10:31:16.423131
updated_at2023-10-30 11:59:40.44384
descriptionA Rust library and CLI tool for Chinese calendar
homepage
repositoryhttps://github.io/supertsy5/nongli
max_upload_size
id1018329
size106,106
SUPERTSY5 (supertsy5)

documentation

https://docs.rs/nongli

README

Nongli: A Rust library and CLI tool for Chinese calendar

github crates.io github License Preview

Note: This project is in early development and not guaranteed to run on every platform. Bug reports are welcome.

Install (as an executable)

cargo install nongli

or

cargo install --git https://github.com/supertsy5/nongli

As a library

Talk is cheap, let me show the code.

fn test() {
    use chrono::NaiveDate;
    use nongli::{ChineseDate, SolarTerm};
    let date = NaiveDate::from_ymd_opt(2023, 10, 30).unwrap();
    let chinese_date = ChineseDate::new(2023, 09, false, 16).unwrap();
    assert_eq!(ChineseDate::from_gregorian(&date), Some(chinese_date));
    assert_eq!(chinese_date.to_gregorian(), date);
    assert_eq!(
        SolarTerm::from_date(&NaiveDate::from_ymd_opt(2023, 10, 25).unwrap()),
        Some(SolarTerm::Shuangjiang)
    );
}

Development

Tip: run

. aliases.sh

for common aliases.

Clone this repository and run:

cargo build
Commit count: 0

cargo fmt