#julian #chrono #date #day #period #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

#327 in Date and time

Download history 42/week @ 2024-07-19 37/week @ 2024-07-26 26/week @ 2024-08-02 32/week @ 2024-08-09 35/week @ 2024-08-16 31/week @ 2024-08-23 13/week @ 2024-08-30 37/week @ 2024-09-06 30/week @ 2024-09-13 47/week @ 2024-09-20 29/week @ 2024-09-27 87/week @ 2024-10-04 79/week @ 2024-10-11 81/week @ 2024-10-18 34/week @ 2024-10-25 31/week @ 2024-11-01

231 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