jdate

Crates.iojdate
lib.rsjdate
version0.1.0
created_at2025-06-20 17:11:06.066974+00
updated_at2025-06-20 17:11:06.066974+00
descriptionA library for converting between Gregorian and Jewish dates
homepage
repositoryhttps://github.com/jfcode4/jdate
max_upload_size
id1719868
size19,052
jfcode4 (jfcode4)

documentation

README

jdate

This is my attempt at writing a Jewish calendar converter in Rust. This was inspired by the hebcal project.

Features

  • Convert a gregorian date to a Jewish date
  • Convert a jewish date to a gregorian date
  • Calculate the molad of the start of a year

Example

use jdate::JDate;
use time::Date;

fn main() {
    // Convert a Gregorian date to a Jewish date
    let date1 = jdate::gdate(2025, 1, 1).unwrap();
    let date2 = JDate::from(date1);
    println!("{date2}"); // prints: 5785-Tevet-01
                         //
    // Convert a Jewish date to a Gregorian date
    let date1 = JDate::new(5785, 1, 1).unwrap();
    let date2 = Date::from(date1);
    println!("{date2}"); // prints: 2025-03-30

    // Convert today's date
    let today = jdate::today();
    let today_jdate = JDate::from(today);
    println!("Today is {today} = {today_jdate}");
}
Commit count: 0

cargo fmt