Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dten/computus
Computus Easter calculation in Rust
https://github.com/dten/computus
Last synced: 2 months 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 (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-03-25T15:55:06.000Z (almost 2 years ago)
- Last Synced: 2024-10-31T11:55:54.972Z (3 months 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
[![crates.io](https://img.shields.io/crates/v/computus.svg)](https://crates.io/crates/computus)
[![Documentation](https://docs.rs/computus/badge.svg)](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));
}
```