pub enum MonthSchedule {
Show 14 variants
BaChaG,
BaShaH,
GaChaH,
HaKaZ,
HaShA,
ZaChA,
ZaShaG,
BaChaH,
BaShaZ,
GaKaZ,
HaChA,
HaShaG,
ZaChaG,
ZaShaH,
}Expand description
A Hebrew year can be defined by three variables:
- The first day of Rosh Hashana - Monday (the second day of the week, represented by Beis - Ba), Tuesday (the third day of the week, represented by Gimmel - Ga), Thursday (the fifth day of the week, represented by Hei - Ha) and Shabbos (the seventh day of the week, represented by Zayin - Za).
- The length of the year, specifically, if Cheshvan and Kislev are both full (Sheleima - 30 days long), empty (Chaseir - 29 days long), or in regular order (“Kesidra”, Cheshvan is 29 days long and Kislev is 30. So the year goes 30,29,30,29 etc.).
- The day Pesach starts, defined as on Rosh Hashana above.
So, for example, 5779 is a BaShaZ year - that is, the first day of Rosh Hashana was on a Monday (Beis - Ba), Bosh Cheshvan and Kislev are full (Shleimah - Shin), and the first night of Pesach was on Friday night (Zain - Z for Shabbos).
§Examples
use heca_lib::HebrewYear;
use heca_lib::prelude::*;
assert_eq!(HebrewYear::new(5779)?.year_type(),MonthSchedule::BaShaZ);§Find out how often does Pesach start on which days:
use heca_lib::HebrewYear;
use heca_lib::prelude::*;
let (mut thu, mut tue, mut sun, mut sat) = (0,0,0,0);
for year in 3765..9999 {
let t = HebrewYear::new(year)?.year_type();
match t {
MonthSchedule::GaChaH
| MonthSchedule::BaShaH
| MonthSchedule::BaChaH
| MonthSchedule::ZaShaH => thu += 1,
MonthSchedule::HaShaG
| MonthSchedule::ZaShaG
| MonthSchedule::ZaChaG
| MonthSchedule::BaChaG => tue += 1,
MonthSchedule::HaShA
| MonthSchedule::ZaChA
| MonthSchedule::HaChA => sun += 1,
MonthSchedule::HaKaZ
| MonthSchedule::BaShaZ
| MonthSchedule::GaKaZ => sat += 1,
}
}
assert_eq!(thu, 1782);
assert_eq!(tue, 1988);
assert_eq!(sun, 718); // <-- Note, that Pesach falls out on a Motzei Shabbos only 10% of the time.
assert_eq!(sat, 1746);
§Find out when will Pesach start on Motzei Shabbos:
use heca_lib::HebrewYear;
use heca_lib::prelude::*;
let mut years: Vec<u64> = Vec::new();
for year in 5780..5880 {
let t = HebrewYear::new(year).unwrap().year_type();
match t {
MonthSchedule::HaShA
| MonthSchedule::ZaChA
| MonthSchedule::HaChA => years.push(year),
_ => { }
}
}
assert_eq!(years, vec![5781, 5785, 5805, 5808, 5812, 5832, 5835, 5839, 5859, 5863] ); // <-- We'll have two of them over the next few years, and then Pesach won't fall out on Motzei Shabbos for twenty years!
Variants§
Trait Implementations§
Source§impl Clone for MonthSchedule
impl Clone for MonthSchedule
Source§fn clone(&self) -> MonthSchedule
fn clone(&self) -> MonthSchedule
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MonthSchedule
impl Debug for MonthSchedule
Source§impl<'de> Deserialize<'de> for MonthSchedule
impl<'de> Deserialize<'de> for MonthSchedule
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for MonthSchedule
impl PartialEq for MonthSchedule
Source§impl Serialize for MonthSchedule
impl Serialize for MonthSchedule
impl Copy for MonthSchedule
impl Eq for MonthSchedule
impl StructuralPartialEq for MonthSchedule
Auto Trait Implementations§
impl Freeze for MonthSchedule
impl RefUnwindSafe for MonthSchedule
impl Send for MonthSchedule
impl Sync for MonthSchedule
impl Unpin for MonthSchedule
impl UnwindSafe for MonthSchedule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more