zmanim-core

Crates.iozmanim-core
lib.rszmanim-core
version0.2.7
created_at2025-08-26 03:21:48.299465+00
updated_at2025-10-13 06:42:43.768955+00
descriptionA high-performance, `no_std` Rust library for calculating Jewish religious times (zmanim) and astronomical events.
homepage
repositoryhttps://github.com/dickermoshe/zmanim-core
max_upload_size
id1810459
size5,930,238
Moshe Dicker (dickermoshe)

documentation

README

[!NOTE] If you are looking for the Python Readme, please see zmanim-core-bindings.
If you are looking for the Javascript Readme, please see zmanim-core-bindings.

Zmanim Core

Crates.io Documentation License Rust

A high-performance, no_std Rust library for calculating Jewish religious times (zmanim) and astronomical events. This library provides accurate calculations for sunrise, sunset, prayer times, and Jewish calendar dates based on astronomical algorithms.

๐ŸŒŸ Features

  • Astronomical Calculations: Precise sunrise, sunset, and astronomical event calculations
  • Jewish Religious Times: Complete zmanim calculations including:
    • Alos Hashachar (dawn)
    • Tzais (nightfall)
    • Chatzos (midday)
    • Prayer times (Shacharis, Mincha, Maariv)
    • Candle lighting times
  • Hebrew Calendar: Full Jewish calendar support with:
    • Date conversions
    • Holiday calculations
    • Parsha (weekly Torah portion) information
    • Daf Yomi calculations
  • Geolocation Support: Location-based calculations using coordinates
  • Cross-Platform: Supports multiple targets including:
    • Windows, Linux, macOS
    • WebAssembly (WASM)
    • Embedded systems (thumbv7em-none-eabihf)
  • High Performance: Optimized Rust implementation with LTO and stripping
  • No Standard Library: no_std compatible for embedded and WASM use cases

Documentation

This fork closely follows the original KosherJava api where possible. See the JavaDoc for documentation: https://kosherjava.com/zmanim/docs/api/index.html?overview-summary.html

๐Ÿš€ Quick Start

Installation

Run the following

cargo add zmanim-core

Basic Usage

use zmanim_core::prelude::*;
use chrono::{DateTime, Utc};

// Create a location (Jerusalem coordinates)
let location = GeoLocation::new(
    31.78,   // latitude
    35.22,   // longitude
    754.0,   // elevation in meters
);

// Create a calendar for a specific date
let timestamp = chrono::Utc::now().timestamp_millis();
let calendar = ZmanimCalendar::new(
    timestamp, 
    location, 
    false,  // Use astronomical chatzos for zmanim
    false,  // Use astronomical chatzos for other zmanim
    18 * 60 * 1000, // Candle lighting offset in milliseconds
);

// Get sunrise and sunset times
if let Some(alos72) = calendar.get_alos72() {
    println!("Alos72: {}", DateTime::from_timestamp_millis(alos72).unwrap());
}

if let Some(sunset) = calendar.get_astronomical_calendar().get_sunset() {
    println!("Sunset: {}", DateTime::from_timestamp_millis(sunset).unwrap());
}

// Get Jewish date information
let jewish_date = JewishDate::from_gregorian(
    timestamp, 
    4 * 60 * 60 * 1000, // Timezone offset in milliseconds (4 Hours)
);
println!("Jewish Date: {} {}, {}", 
    jewish_date.get_day_of_month(),
    jewish_date.get_jewish_month_name(),
    jewish_date.get_jewish_year()
);

๐Ÿงช Testing

This library includes comprehensive testing against the original KosherJava implementation to ensure accuracy and correctness.

Run Tests

# Run all tests
cargo test

# Run tests with output
cargo test -- --nocapture

# Run specific test module
cargo test zmanim_calendar_tests

Test Coverage

The test suite includes:

  • Unit tests for all modules

  • Integration tests against Java reference implementation

  • Astronomical calculation accuracy tests

  • Jewish calendar correctness tests

  • Cross-platform compatibility tests

Features

The library supports multiple build targets:

  • Native: Windows, Linux, macOS
  • WebAssembly: Browser and Node.js compatibility
  • Embedded: ARM Cortex-M7 and similar microcontrollers

๐Ÿ“– Documentation

๐Ÿค Contributing

We welcome contributions! Please see our contributing guidelines:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Ensure all tests pass
  6. Submit a pull request

Development Setup

# Clone the repository
git clone https://github.com/dickermoshe/zmanim-core.git
cd zmanim-core

# Install dependencies
cargo build

# Run tests
cargo test

# Check formatting
cargo fmt --check

# Run clippy
cargo clippy

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

This library is a Rust port of the KosherJava library, which provides the reference implementation and testing framework. Special thanks to the KosherJava contributors for their excellent work.

๐Ÿ“ž Support


Made with โค๏ธ for the Jewish community and Rust enthusiasts

Commit count: 93

cargo fmt