heca_lib/convert/year.rs
1use std::convert::{TryFrom, TryInto};
2
3use smallvec::*;
4
5use crate::convert::year::backend::{CHALAKIM_BETWEEN_MOLAD, FIRST_MOLAD};
6use crate::convert::*;
7use crate::holidays::get_chol_list;
8use crate::holidays::get_shabbos_list;
9use crate::holidays::get_special_parsha_list;
10use crate::holidays::get_yt_list;
11use chrono::{Duration, Utc};
12use std::num::NonZeroI8;
13
14pub(crate) mod backend;
15
16use crate::convert::year::backend::{
17 get_rosh_hashana, months_per_year, return_year_sched, CHALAKIM_PER_HOUR, EPOCH, FIRST_YEAR,
18 YEAR_SCHED,
19};
20use crate::prelude::HebrewMonth::{Adar, Adar1, Adar2};
21use crate::prelude::{ConversionError, HebrewMonth, Molad};
22
23/// HebrewYear holds data on a given year. It's faster to get multiple HebrewDates from
24/// an existing HebrewYear rather than generating each one on its own.
25#[derive(Copy, Clone, Debug)]
26pub struct HebrewYear {
27 pub(crate) year: u64,
28 pub(crate) day_of_rh: Day,
29 pub(crate) day_of_next_rh: Day,
30 pub(crate) months_per_year: u64,
31 pub(crate) sched: [u8; 14],
32 pub(crate) year_len: u64,
33 pub(crate) days_since_epoch: u64,
34 pub(crate) chalakim_since_epoch: u64,
35}
36
37impl HebrewYear {
38 #[inline]
39 pub fn new(year: u64) -> Result<HebrewYear, ConversionError> {
40 //! Returns a new HebrewYear on success or a ConversionError on failure.
41 //!
42 //! # Arguments
43 //!
44 //! `year` - The Hebrew year
45 //!
46 if year < FIRST_YEAR + 1 {
47 Err(ConversionError::YearTooSmall)
48 } else {
49 let cur_rh = get_rosh_hashana(year);
50 let next_rh = get_rosh_hashana(year + 1);
51 let days_since_epoch = cur_rh.0;
52 let chalakim_since_epoch = cur_rh.2;
53 let year_len = next_rh.0 - cur_rh.0;
54 let months_per_year = months_per_year(year);
55 let sched = &YEAR_SCHED[return_year_sched(year_len)];
56
57 Ok(HebrewYear {
58 day_of_rh: get_rosh_hashana(year).1,
59 year,
60 day_of_next_rh: get_rosh_hashana(year + 1).1,
61 months_per_year,
62 sched: sched.clone(),
63 days_since_epoch,
64 year_len,
65 chalakim_since_epoch,
66 })
67 }
68 }
69
70 #[inline]
71 /// Returns if this year is a leap year.
72 ///
73 /// ```
74 /// use heca_lib::prelude::*;
75 /// use heca_lib::HebrewYear;
76 /// assert_eq!(HebrewYear::new(5779)?.is_leap_year(),true);
77 /// # Ok::<(),ConversionError>(())
78 /// ```
79 pub fn is_leap_year(&self) -> bool {
80 self.months_per_year == 13
81 }
82
83 #[inline]
84 /// Returns the type of year.
85 ///
86 /// A Hebrew year can be one of 14 combinations of length and starting day.
87 ///
88 /// # Returns
89 ///
90 /// A [MonthSchedule](../heca_lib/prelude/enum.MonthSchedule.html)
91 pub fn year_type(&self) -> MonthSchedule {
92 if self.months_per_year == 12 {
93 match self.day_of_rh {
94 Day::Monday => {
95 if self.sched[1] == 30 && self.sched[2] == 30 {
96 MonthSchedule::BaShaH
97 } else if self.sched[1] == 29 && self.sched[2] == 29 {
98 MonthSchedule::BaChaG
99 } else {
100 panic!(format!(
101 "Year {} is 12 months, stars on Monday, yet has Cheshvan {} days and Kislev {} days",
102 self.year, self.sched[1], self.sched[2]
103 ))
104 }
105 }
106 Day::Tuesday => {
107 if self.sched[1] == 29 && self.sched[2] == 30 {
108 MonthSchedule::GaChaH
109 } else {
110 panic!(format!(
111 "Year {} is 12 months, starts on Tuesday, yet has Cheshvan {} days and Kislev {} days",
112 self.year, self.sched[1], self.sched[2]
113 ))
114 }
115 }
116 Day::Thursday => {
117 if self.sched[1] == 29 && self.sched[2] == 30 {
118 MonthSchedule::HaKaZ
119 } else if self.sched[1] == 30 && self.sched[2] == 30 {
120 MonthSchedule::HaShA
121 } else {
122 panic!(format!(
123 "Year {} is 12 months, starts on Thursday, yet has Cheshvan {} days and Kislev {} days",
124 self.year, self.sched[1], self.sched[2]
125 ))
126 }
127 }
128 Day::Shabbos => {
129 if self.sched[1] == 30 && self.sched[2] == 30 {
130 MonthSchedule::ZaShaG
131 } else if self.sched[1] == 29 && self.sched[2] == 29 {
132 MonthSchedule::ZaChA
133 } else {
134 panic!(format!(
135 "Year {} is 12 months, stars on Shabbos, yet has Cheshvan {} days and Kislev {} days",
136 self.year, self.sched[1], self.sched[2]
137 ))
138 }
139 }
140 x => panic!(format!("Rosh Hashana should never fall out on {:?}", x)),
141 }
142 } else {
143 match self.day_of_rh {
144 Day::Monday => {
145 if self.sched[1] == 30 && self.sched[2] == 30 {
146 MonthSchedule::BaShaZ
147 } else if self.sched[1] == 29 && self.sched[2] == 29 {
148 MonthSchedule::BaChaH
149 } else {
150 panic!(format!(
151 "Year {} is 13 months, stars on Monday, yet has Cheshvan {} days and Kislev {} days",
152 self.year, self.sched[1], self.sched[2]
153 ))
154 }
155 }
156 Day::Tuesday => {
157 if self.sched[1] == 29 && self.sched[2] == 30 {
158 MonthSchedule::GaKaZ
159 } else {
160 panic!(format!(
161 "Year {} is 13 months, starts on Tuesday, yet has Cheshvan {} days and Kislev {} days",
162 self.year, self.sched[1], self.sched[2]
163 ))
164 }
165 }
166 Day::Thursday => {
167 if self.sched[1] == 30 && self.sched[2] == 30 {
168 MonthSchedule::HaShaG
169 } else if self.sched[1] == 29 && self.sched[2] == 29 {
170 MonthSchedule::HaChA
171 } else {
172 panic!(format!(
173 "Year {} is 13 months, starts on Thursday, yet has Cheshvan {} days and Kislev {} days",
174 self.year, self.sched[1], self.sched[2]
175 ))
176 }
177 }
178 Day::Shabbos => {
179 if self.sched[1] == 30 && self.sched[2] == 30 {
180 MonthSchedule::ZaShaH
181 } else if self.sched[1] == 29 && self.sched[2] == 29 {
182 MonthSchedule::ZaChaG
183 } else {
184 panic!(format!(
185 "Year {} is 13 months, stars on Shabbos, yet has Cheshvan {} days and Kislev {} days",
186 self.year, self.sched[1], self.sched[2]
187 ))
188 }
189 }
190 x => panic!(format!("Rosh Hashana should never fall out on {:?}", x)),
191 }
192 }
193 }
194
195 /// Returns the year.
196 ///
197 /// # Examples:
198 ///
199 /// ```
200 /// use std::num::NonZeroI8;
201 /// use heca_lib::prelude::*;
202 /// use heca_lib::{HebrewDate, HebrewYear};
203 /// let year = HebrewYear::new(5779)?;
204 /// assert_eq!(year.year(), 5779);
205 /// # Ok::<(),ConversionError>(())
206 /// ```
207 #[inline]
208 pub fn year(&self) -> u64 {
209 self.year
210 }
211 /// Returns a HebrewDate from the current year and a supplied month and day.
212 ///
213 /// # Arguments:
214 ///
215 /// `month` - The Hebrew month.
216 ///
217 /// `day` - The day of the Hebrew month.
218 ///
219 /// # Examples:
220 ///
221 /// ```
222 /// use std::num::NonZeroI8;
223 /// use heca_lib::prelude::*;
224 /// use heca_lib::{HebrewDate, HebrewYear};
225 /// let year = HebrewYear::new(5779)?;
226 /// assert_eq!(
227 /// year.get_hebrew_date(HebrewMonth::Tishrei, NonZeroI8::new(10).unwrap())?,
228 /// HebrewDate::from_ymd(5779, HebrewMonth::Tishrei, NonZeroI8::new(10).unwrap())?
229 /// );
230 /// # Ok::<(),ConversionError>(())
231 /// ```
232 ///
233 /// # Notes:
234 ///
235 /// Day must be above zero. If it's below zero, the function returns TooManyDaysInMonth. In a future release, day will be a NonZeroU8 so that it will be impossible to supply a negative number.
236 #[inline]
237 pub fn get_hebrew_date(
238 self,
239 month: HebrewMonth,
240 day: NonZeroI8,
241 ) -> Result<HebrewDate, ConversionError> {
242 HebrewDate::from_ymd_internal(month, day, self)
243 }
244
245 pub(crate) fn get_hebrewdate_from_days_after_rh(self, amnt_days: u64) -> HebrewDate {
246 let mut remainder = amnt_days - self.days_since_epoch;
247 let mut month: u64 = 0;
248 for days_in_month in self.sched.iter() {
249 if remainder < u64::from(*days_in_month) {
250 break;
251 }
252 month += 1;
253 remainder -= u64::from(*days_in_month);
254 }
255 HebrewDate {
256 year: self,
257 month: HebrewMonth::from(month),
258 day: NonZeroI8::new((remainder + 1) as i8).unwrap(),
259 }
260 }
261 /// Returns all the days when the Torah is read.
262 ///
263 /// # Arguments
264 ///
265 /// `location` - Specify if you're looking for the calendar in Israel or in the Diaspora. Is
266 /// relevent as there's only one day of Yom Tov in Israel while there are two day of Yom Tov outside.
267 /// Since we don't read the Weekly Parsha on Yom Tov, in a year when the 8th day of Pesach is on a Shabbos,
268 /// Israelis read the next Parsha while the Diaspora reads the Yom Tov Parsha, catching up in the summer.
269 ///
270 /// `yt_types` - An array containing `TorahReadingType`. This should be used as a flag to
271 /// specify which types of Torah readings you want to list.
272 ///
273 /// # Returns
274 ///
275 /// Returns an array (or a vec) of days.
276 ///
277 /// # Note
278 ///
279 /// This may unsorted, and is returned under no defined order.
280 ///
281 /// # Examples
282 ///
283 /// ```
284 /// use std::num::NonZeroI8;
285 /// use heca_lib::prelude::*;
286 /// use heca_lib::{HebrewDate, HebrewYear};
287 /// let year = HebrewYear::new(5779)?;
288 /// let shabbosim = year.get_holidays(Location::Chul, &[TorahReadingType::Shabbos, TorahReadingType::SpecialParsha, TorahReadingType::Chol, TorahReadingType::YomTov]);
289 /// let mut count = 0;
290 /// for s in shabbosim.into_iter() {
291 /// if s.name() == TorahReading::Shabbos(Parsha::Bereishis) {
292 /// assert_eq!(s.day(), HebrewDate::from_ymd(5779,HebrewMonth::Tishrei, NonZeroI8::new(27).unwrap())?);
293 /// count += 1;
294 /// }
295 /// else if s.name() == TorahReading::SpecialParsha(SpecialParsha::Zachor) {
296 /// assert_eq!(s.day(), HebrewDate::from_ymd(5779,HebrewMonth::Adar2, NonZeroI8::new(9).unwrap())?);
297 /// count += 1;
298 /// }
299 /// else if s.name() == TorahReading::Chol(Chol::Chanukah1) {
300 /// assert_eq!(s.day(), HebrewDate::from_ymd(5779,HebrewMonth::Kislev, NonZeroI8::new(25).unwrap())?);
301 /// count += 1;
302 /// }
303 /// else if s.name() == TorahReading::YomTov(YomTov::Shavuos1) {
304 /// assert_eq!(s.day(), HebrewDate::from_ymd(5779,HebrewMonth::Sivan, NonZeroI8::new(6).unwrap())?);
305 /// count += 1;
306 /// }
307 /// }
308 /// assert_eq!(count,4);
309 /// # Ok::<(),ConversionError>(())
310 /// ```
311 pub fn get_holidays(
312 &self,
313 location: Location,
314 yt_types: &[TorahReadingType],
315 ) -> SmallVec<[TorahReadingDay; 256]> {
316 let mut return_vec: SmallVec<[TorahReadingDay; 256]> = SmallVec::new();
317 if yt_types.contains(&TorahReadingType::YomTov) {
318 return_vec.extend_from_slice(&get_yt_list(self.clone(), location));
319 }
320 if yt_types.contains(&TorahReadingType::Chol) {
321 return_vec.extend_from_slice(&get_chol_list(self.clone()));
322 }
323 if yt_types.contains(&TorahReadingType::Shabbos) {
324 return_vec.extend_from_slice(&get_shabbos_list(self.clone(), location));
325 }
326 if yt_types.contains(&TorahReadingType::SpecialParsha) {
327 return_vec.extend_from_slice(&get_special_parsha_list(self.clone()));
328 }
329 return_vec
330 }
331
332 /// Returns the Molad of a given month, or a ConversionError if trying to get Molad of a month which is does not exist in that year.
333 ///
334 /// # Note:
335 /// The Molad has no modern Halachic significance since Rosh Chodesh isn't derived from the Molad. However, it is useful to know as some say that one should know the Molad during the Birkas HaChodesh.
336 pub fn get_molad(&self, month: HebrewMonth) -> Result<Molad, ConversionError> {
337 let chalakim_since_epoch = if self.is_leap_year() {
338 match month {
339 HebrewMonth::Tishrei => 0,
340 HebrewMonth::Cheshvan => 1,
341 HebrewMonth::Kislev => 2,
342 HebrewMonth::Teves => 3,
343 HebrewMonth::Shvat => 4,
344 Adar1 => 5,
345 Adar2 => 6,
346 HebrewMonth::Nissan => 7,
347 HebrewMonth::Iyar => 8,
348 HebrewMonth::Sivan => 9,
349 HebrewMonth::Tammuz => 10,
350 HebrewMonth::Av => 11,
351 HebrewMonth::Elul => 12,
352 Adar => {
353 return Err(ConversionError::IsLeapYear);
354 }
355 }
356 } else {
357 match month {
358 HebrewMonth::Tishrei => 0,
359 HebrewMonth::Cheshvan => 1,
360 HebrewMonth::Kislev => 2,
361 HebrewMonth::Teves => 3,
362 HebrewMonth::Shvat => 4,
363 HebrewMonth::Adar => 5,
364 HebrewMonth::Nissan => 6,
365 HebrewMonth::Iyar => 7,
366 HebrewMonth::Sivan => 8,
367 HebrewMonth::Tammuz => 9,
368 HebrewMonth::Av => 10,
369 HebrewMonth::Elul => 11,
370 Adar1 => return Err(ConversionError::IsNotLeapYear),
371 Adar2 => return Err(ConversionError::IsNotLeapYear),
372 }
373 } * CHALAKIM_BETWEEN_MOLAD
374 + self.chalakim_since_epoch
375 + FIRST_MOLAD;
376 let minutes_since_epoch = (chalakim_since_epoch / (CHALAKIM_PER_HOUR / 60))
377 .try_into()
378 .unwrap();
379 let remainder = (chalakim_since_epoch % (CHALAKIM_PER_HOUR / 60))
380 .try_into()
381 .unwrap();
382 let day = EPOCH.clone() + Duration::minutes(minutes_since_epoch);
383 Ok(Molad { day, remainder })
384 }
385}
386
387#[test]
388fn test_get_molad() {
389 use chrono::prelude::*;
390 let hebrew_year = HebrewYear::new(5780).unwrap();
391 let p = hebrew_year.get_molad(HebrewMonth::Tishrei).unwrap();
392 assert_eq!(
393 p,
394 Molad {
395 day: Utc.ymd(2019, 9, 29).and_hms(5, 50, 0),
396 remainder: 5
397 }
398 );
399 let p = hebrew_year.get_molad(HebrewMonth::Cheshvan).unwrap();
400 assert_eq!(
401 p,
402 Molad {
403 day: Utc.ymd(2019, 10, 28).and_hms(18, 34, 0),
404 remainder: 6
405 }
406 );
407
408 let hebrew_year = HebrewYear::new(5781).unwrap();
409 let p = hebrew_year.get_molad(HebrewMonth::Elul).unwrap();
410 assert_eq!(
411 p,
412 Molad {
413 day: Utc.ymd(2021, 8, 8).and_hms(10, 43, 0),
414 remainder: 10
415 }
416 );
417
418 //check error
419 let hebrew_year = HebrewYear::new(5780).unwrap();
420 assert_eq!(
421 hebrew_year.get_molad(HebrewMonth::Adar1),
422 Err(ConversionError::IsNotLeapYear)
423 );
424
425 let hebrew_year = HebrewYear::new(5779).unwrap();
426 assert_eq!(
427 hebrew_year.get_molad(HebrewMonth::Adar),
428 Err(ConversionError::IsLeapYear)
429 );
430}
431
432/// Returns a HebrewDate on success, or a ConversionError on failure.
433///
434/// # Arguments
435/// * `date` - The Gregorian date.
436///
437/// # Note:
438/// Hebrew days start at sundown, not midnight, so there isn't a full 1:1 mapping between
439/// Gregorian days and Hebrew. So when you look up the date of Rosh Hashana 5779, most calendars will say that it's on Monday the 10th of September, 2018, while Rosh Hashana really started at sundown on the 9th of September.
440///
441/// I'm trying to be a _bit_ more precise, so I made the date cutoff at 6:00 PM. So for example:
442///
443/// ```
444/// use std::num::NonZeroI8;
445/// use std::convert::TryInto;
446///
447/// use chrono::Utc;
448/// use chrono::offset::TimeZone;
449/// use heca_lib::prelude::*;
450/// use heca_lib::HebrewDate;
451///
452/// let hebrew_date: HebrewDate = Utc.ymd(2018,9,10).and_hms(17,59,59).try_into()?;
453/// assert_eq!(hebrew_date,HebrewDate::from_ymd(5779,HebrewMonth::Tishrei,NonZeroI8::new(1).unwrap())?);
454/// # Ok::<(),ConversionError>(())
455/// ```
456///
457/// while
458///
459/// ```
460/// use std::num::NonZeroI8;
461/// use std::convert::TryInto;
462///
463/// use chrono::Utc;
464/// use chrono::offset::TimeZone;
465/// use heca_lib::prelude::*;
466/// use heca_lib::HebrewDate;
467///
468///
469/// let hebrew_date: HebrewDate = Utc.ymd(2018,9,10).and_hms(18,0,0).try_into()?;
470/// assert_eq!(hebrew_date, HebrewDate::from_ymd(5779,HebrewMonth::Tishrei,NonZeroI8::new(2).unwrap())?);
471/// # Ok::<(),ConversionError>(())
472/// ```
473/// # Error Values:
474/// * YearTooSmall - This algorithm won't work if the year is before year 4.
475///
476impl TryFrom<DateTime<Utc>> for HebrewDate {
477 type Error = ConversionError;
478 fn try_from(original_day: DateTime<Utc>) -> Result<HebrewDate, ConversionError> {
479 HebrewDate::from_gregorian(original_day)
480 }
481}
482
483/// Gets the Gregorian date for the current Hebrew date.
484///
485/// # Notes
486///
487/// This function returns the DateTime of the given HebrewDate at nightfall.
488///
489/// For example, Yom Kippur 5779 started at sunset of September 18, 2018. So
490/// ```
491/// use std::num::NonZeroI8;
492///
493/// use chrono::prelude::*;
494/// use heca_lib::prelude::*;
495/// use heca_lib::HebrewDate;
496///
497/// let gregorian_date: DateTime<Utc> = HebrewDate::from_ymd(5779,HebrewMonth::Tishrei,NonZeroI8::new(10).unwrap())?.into();
498/// assert_eq!(gregorian_date ,Utc.ymd(2018, 9,18).and_hms(18,00,00));
499/// # Ok::<(),ConversionError>(())
500/// ```
501/// ## Algorithm:
502/// The conversion is done (at the moment) according to the calculation of the Rambam (Maimonidies), as is documented in [Hilchos Kiddush Ha'chodesh](https://www.sefaria.org/Mishneh_Torah%2C_Sanctification_of_the_New_Month.6.1?lang=bi&with=all&lang2=en).
503///
504/// The algorithm is as follows:
505///
506/// 1. There are exactly 1080 Chalakim (parts) in an hour.
507/// 2. There are exactly (well, not really. But it's close enough that we use that number as exact.) 29 days, 12 hours, and 793 Chalakim between new moons.
508///
509/// So that's the basic numbers. Regarding the calendar itself:
510///
511/// 3. All months are either 29 or 30 days long.
512/// 4. There are either 12 or 13 months in the Hebrew calendar, depending if it's a leap year. When it's a leap year, Adar (which generally is in the late winter or early spring) is doubled into a "first Adar" (Adar1) and a "second Adar" (Adar2).
513/// 5. There is a 19 year cycle of leap years. So the first two years of the cycle are regular years, the one after that's a leap year. Then another two are regular, then a leap year. Then it's regular, leap, regular, regular, leap, regular, regular, leap.
514/// 6. Year 3763 was the first year of its 19 year cycle.
515/// 7. Now you can calculate when's the New Moon before a given Rosh Hashana.
516///
517/// So how to calculate Rosh Hashana:
518///
519/// 8. If the New Moon is in the afternoon, Rosh Hashana is postponed to the next day.
520/// 9. If Rosh Hashana's starting on a Sunday (Saturday night), Wednesday (Tuesday night), or Friday (Thursday night) - postpone it by a day.
521///
522/// If any of the above two conditions were fulfilled. Good. You just found Rosh Hashana. If not:
523///
524/// 10. If the New Moon is on a Tuesday after 3am+204 Chalakim and the coming year is not a leap year, Rosh Hashana is postponed to that upcoming Thursday instead.
525/// 11. If the New Moon is on a Monday after 9am+589 Chalakim, and the previous year was a leap year, then Rosh Hashana is postponed to Tuesday.
526///
527///
528/// Now you have all the Rosh Hashanas.
529///
530/// 12. In general, months alternate between “Full” (30 days long) and “Empty” (29 days long) months. So Tishrei is full, Teves is empty, Shvat is full, Adar is empty, Nissan is full.
531/// 13. When the year is a leap year, Adar 1 is full and Adar 2 is empty. (So a full Shvat is followed by a full Adar1).
532///
533/// Knowing this, you can calculate any other date of the year.
534///
535/// But wait! We're playing with the date when Rosh Hashana will start, so not every year will be the same length! How do we make up these days?
536///
537/// So there's a last little bit:
538///
539/// 14. Cheshvan and Kislev are variable length months – some years both are full, some years both are empty, and some years Cheshvan is full and Kislev is empty - depending on the day Rosh Hashana starts (and the day _the next Rosh Hashana starts_) and how many days are in the year.
540impl From<HebrewDate> for DateTime<Utc> {
541 fn from(h: HebrewDate) -> Self {
542 h.to_gregorian()
543 }
544}
545
546mod test {
547 #[test]
548 fn make_new_year() {
549 use super::*;
550
551 for i in 4000..5000 {
552 println!("{}", i);
553 HebrewYear::new(i).unwrap();
554 }
555 }
556
557 #[test]
558 fn check_year_type() {
559 use super::*;
560 use chrono::prelude::*;
561
562 for i in 3765..9999 {
563 println!("{}", i);
564 let y = HebrewYear::new(i).unwrap();
565 let t = y.year_type();
566 match t {
567 MonthSchedule::GaChaH
568 | MonthSchedule::BaShaH
569 | MonthSchedule::BaChaH
570 | MonthSchedule::ZaShaH => assert_eq!(
571 y.get_hebrew_date(HebrewMonth::Nissan, NonZeroI8::new(16).unwrap())
572 .unwrap()
573 .to_gregorian()
574 .weekday(),
575 Weekday::Thu
576 ),
577
578 MonthSchedule::HaShaG
579 | MonthSchedule::ZaShaG
580 | MonthSchedule::ZaChaG
581 | MonthSchedule::BaChaG => assert_eq!(
582 y.get_hebrew_date(HebrewMonth::Nissan, NonZeroI8::new(16).unwrap())
583 .unwrap()
584 .to_gregorian()
585 .weekday(),
586 Weekday::Tue
587 ),
588 MonthSchedule::HaShA | MonthSchedule::ZaChA | MonthSchedule::HaChA => assert_eq!(
589 y.get_hebrew_date(HebrewMonth::Nissan, NonZeroI8::new(16).unwrap())
590 .unwrap()
591 .to_gregorian()
592 .weekday(),
593 Weekday::Sun
594 ),
595 MonthSchedule::HaKaZ | MonthSchedule::BaShaZ | MonthSchedule::GaKaZ => assert_eq!(
596 y.get_hebrew_date(HebrewMonth::Nissan, NonZeroI8::new(16).unwrap())
597 .unwrap()
598 .to_gregorian()
599 .weekday(),
600 Weekday::Sat
601 ),
602 }
603 }
604 }
605}