Skip to main content

chiluf_mishmaros/
chiluf_mishmaros.rs

1// calculate the beginning of the second ashmura, the correct time to start
2// slichos according to some opinions
3use jiff::{Span, civil, tz::TimeZone};
4use rust_zmanim::prelude::*;
5use std::ops::Add;
6
7fn main() {
8    let new_york = TimeZone::get("America/New_York").unwrap();
9    // first night of slichos
10    let date = civil::date(2025, 9, 13);
11    let yu = GeoLocation::new(40.8506041, -73.9297205, 0.0, new_york).unwrap();
12
13    // beginning of the night
14    let sunset = zmanim_calculator::shkia(date, &yu, false).unwrap();
15
16    // add a day to calculate sunrise the next day
17    let tomorrow = date.add(Span::new().days(1));
18    // end of the night
19    let sunrise = zmanim_calculator::hanetz(tomorrow, &yu, false).unwrap();
20
21    // each ashmura is 1/3 of the night
22    let ashmura = sunrise.duration_since(&sunset) / 3;
23    // first chiluf mishmaros is one ashmura into the night
24    let chiluf1 = sunset.add(ashmura).strftime("%Y-%m-%d %H:%M:%S %Z");
25    println!("{chiluf1}");
26}