https://github.com/dten/computus
Computus Easter calculation in Rust
https://github.com/dten/computus
Last synced: about 1 year ago
JSON representation
Computus Easter calculation in Rust
- Host: GitHub
- URL: https://github.com/dten/computus
- Owner: dten
- License: mit
- Created: 2016-03-30T18:53:01.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2023-03-25T15:55:06.000Z (about 3 years ago)
- Last Synced: 2024-10-31T11:55:54.972Z (over 1 year ago)
- Language: Rust
- Homepage:
- Size: 11.7 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Computus
[](https://crates.io/crates/computus)
[](https://docs.rs/computus)
Computus Easter calculation in Rust
## Usage
Add this to your Cargo.toml:
```toml
[dependencies]
computus = "1.1.0"
```
You can find when Easter Sunday is for a particular year with:
```rust
// 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));
}
```