Crates.io | computus |
lib.rs | computus |
version | 1.1.0 |
source | src |
created_at | 2016-03-30 19:26:12.218025 |
updated_at | 2023-03-25 14:58:24.18055 |
description | Computus Easter calculation in Rust |
homepage | https://github.com/dten/computus |
repository | https://github.com/dten/computus |
max_upload_size | |
id | 4624 |
size | 8,540 |
Computus Easter calculation in Rust
Add this to your Cargo.toml:
[dependencies]
computus = "1.1.0"
You can find when Easter Sunday is for a particular year with:
// For Gregorian calendars
let easter = computus::gregorian(2016).unwrap();
assert_eq!((easter.month, easter.day), (3, 27));
// For Julian calendars
let easter = computus::julian(2016).unwrap();
assert_eq!((easter.month, easter.day), (4, 18));
// With `chrono` feature
#[cfg(feature = "chrono")] {
use chrono::Datelike;
let easter = computus::gregorian_naive(2023).unwrap();
assert_eq!((easter.month(), easter.day()), (4, 9));
}