Skip to content

Commit

Permalink
Update examples in README
Browse files Browse the repository at this point in the history
  • Loading branch information
jwodder committed May 2, 2023
1 parent d58b4fe commit 3ca0aa6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@ Examples
========

Before you construct a date, you must first choose a calendar in which to
reckon dates. `Calendar::gregorian()` gives you a proleptic Gregorian
calendar, which should be both simple and useful enough for most basic
purposes.
reckon dates. `Calendar::GREGORIAN` is the proleptic Gregorian calendar, which
should be both simple and useful enough for most basic purposes.

To convert a Julian day number to a date in a calendar, use the
`Calendar::at_jdn()` method, like so:

```rust
use julian::{Calendar, Month};

let cal = Calendar::gregorian();
let cal = Calendar::GREGORIAN;
let date = cal.at_jdn(2460065);
assert_eq!(date.year(), 2023);
assert_eq!(date.month(), Month::April);
Expand All @@ -45,7 +44,7 @@ the date, and then call its `julian_day_number()` method:
```rust
use julian::{Calendar, Month};

let cal = Calendar::gregorian();
let cal = Calendar::GREGORIAN;
let date = cal.at_ymd(2023, Month::April, 30).unwrap();
assert_eq!(date.julian_day_number(), 2460065);
```
Expand Down

0 comments on commit 3ca0aa6

Please sign in to comment.