Crates.io | nongli |
lib.rs | nongli |
version | |
source | src |
created_at | 2023-10-30 10:31:16.423131+00 |
updated_at | 2025-01-10 17:51:09.691297+00 |
description | A Rust library and CLI tool for Chinese calendar |
homepage | |
repository | https://github.com/supertsy5/nongli |
max_upload_size | |
id | 1018329 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Note: This project is in early development and not guaranteed to run on every platform. Bug reports are welcome.
cargo install nongli
or
cargo install --git https://github.com/supertsy5/nongli
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)
);
}
Tip: run
. aliases.sh
for common aliases.
Clone this repository and run:
cargo build