computus

Crates.iocomputus
lib.rscomputus
version1.1.0
sourcesrc
created_at2016-03-30 19:26:12.218025
updated_at2023-03-25 14:58:24.18055
descriptionComputus Easter calculation in Rust
homepagehttps://github.com/dten/computus
repositoryhttps://github.com/dten/computus
max_upload_size
id4624
size8,540
David Hewson (dten)

documentation

README

Computus

crates.io Documentation

Computus Easter calculation in Rust

Usage

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));
}
Commit count: 21

cargo fmt