#julian #day #chrono #beginning #period #continuous #naive-date

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

#339 in Date and time

Download history 95/week @ 2023-11-20 24/week @ 2023-11-27 4/week @ 2023-12-04 83/week @ 2023-12-18 16/week @ 2023-12-25 2/week @ 2024-01-01 122/week @ 2024-01-08 164/week @ 2024-01-15 108/week @ 2024-01-22 57/week @ 2024-01-29 96/week @ 2024-02-05 88/week @ 2024-02-12 97/week @ 2024-02-19 64/week @ 2024-02-26 173/week @ 2024-03-04

426 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