#julian #date #day #period #chrono #convert #modified-julian-day

julianday

Julian day is the continuous count of days since the beginning of the Julian Period. This crate implements a method to convert a JulianDay or ModifiedJulianDay to and from the chrono's NaiveDate.

6 releases (stable)

1.2.0 Aug 26, 2022
1.1.0 Jul 11, 2022
1.0.1 Jun 30, 2022
0.2.0 May 2, 2020
0.1.0 May 2, 2020

#369 in Date and time

Download history 85/week @ 2024-11-13 54/week @ 2024-11-20 27/week @ 2024-11-27 27/week @ 2024-12-04 36/week @ 2024-12-11 19/week @ 2024-12-18 5/week @ 2024-12-25 31/week @ 2025-01-22 31/week @ 2025-01-29 274/week @ 2025-02-05 14/week @ 2025-02-12 15/week @ 2025-02-19 46/week @ 2025-02-26

362 downloads per month
Used in 2 crates

MIT license

9KB
154 lines

mirror mirror crates.io docs.rs

Julian day is the continuous count of days since the beginning of the Julian Period. This crate implements a method to convert a JulianDay to and from the chrono's NaiveDate.

Julian Day (JD)

use chrono::NaiveDate;
use julianday::JulianDay;

fn main() {
    let naivedate = NaiveDate::from_ymd(2020, 2, 18);
    let julianday = JulianDay::from(naivedate);
    let date = julianday.to_date();
}

Modified Julian Day (MJD)

use chrono::NaiveDate;
use julianday::ModifiedJulianDay;

fn main() {
    let naivedate = NaiveDate::from_ymd(2020, 2, 18);
    let mjd = ModifiedJulianDay::from(naivedate);
    let date = mjd.to_date();
}

Dependencies

~1MB
~18K SLoC