#julian #date #day #period #chrono #convert #continuous

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

#290 in Date and time

Download history 125/week @ 2024-06-17 104/week @ 2024-06-24 73/week @ 2024-07-01 39/week @ 2024-07-08 23/week @ 2024-07-15 47/week @ 2024-07-22 37/week @ 2024-07-29 23/week @ 2024-08-05 35/week @ 2024-08-12 31/week @ 2024-08-19 31/week @ 2024-08-26 11/week @ 2024-09-02 38/week @ 2024-09-09 37/week @ 2024-09-16 39/week @ 2024-09-23 38/week @ 2024-09-30

152 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