5 releases (3 stable)
| 2.0.0 | Apr 5, 2026 |
|---|---|
| 1.1.0 | Mar 25, 2023 |
| 1.0.0 | Jan 6, 2017 |
| 0.1.1 | Mar 31, 2016 |
| 0.1.0 | Mar 30, 2016 |
#64 in Date and time
33,458 downloads per month
Used in 10 crates
(7 directly)
10KB
162 lines
Computus
Computus Easter calculation in Rust
Usage
Add this to your Cargo.toml:
[dependencies]
computus = "2.0.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));
}
// With `jiff` feature
#[cfg(feature = "jiff")] {
use jiff::civil::Date;
let easter = computus::gregorian_jiff_date(2023).unwrap();
assert_eq!((easter.month(), easter.day()), (4, 9));
}
Dependencies
~0–1.4MB
~21K SLoC