5 releases
| 0.2.7 | Oct 13, 2025 |
|---|---|
| 0.2.6 | Oct 13, 2025 |
| 0.2.1 | Aug 28, 2025 |
| 0.2.0 | Aug 26, 2025 |
| 0.1.0 | Aug 26, 2025 |
#131 in Date and time
371 downloads per month
1MB
18K
SLoC
Contains (JAR file, 90KB) zmanim-2.6.0-SNAPSHOT.jar
[!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
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_stdcompatible 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
- API Reference: docs.rs/zmanim-core
- Tests: Comprehensive test suite in
tests/
๐ค Contributing
We welcome contributions! Please see our contributing guidelines:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- 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
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: docs.rs/zmanim-core
Made with โค๏ธ for the Jewish community and Rust enthusiasts
Dependencies
~4.5โ6MB
~113K SLoC