[][src]Enum heca_lib::prelude::MonthSchedule

pub enum MonthSchedule {
    BaChaG,
    BaShaH,
    GaChaH,
    HaKaZ,
    HaShA,
    ZaChA,
    ZaShaG,
    BaChaH,
    BaShaZ,
    GaKaZ,
    HaChA,
    HaShaG,
    ZaChaG,
    ZaShaH,
}

A Hebrew year can be defined by three variables:

  1. 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).
  2. 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.).
  3. 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

BaChaG
BaShaH
GaChaH
HaKaZ
HaShA
ZaChA
ZaShaG
BaChaH
BaShaZ
GaKaZ
HaChA
HaShaG
ZaChaG
ZaShaH

Trait Implementations

impl Clone for MonthSchedule[src]

impl Copy for MonthSchedule[src]

impl Debug for MonthSchedule[src]

impl<'de> Deserialize<'de> for MonthSchedule[src]

impl Eq for MonthSchedule[src]

impl PartialEq<MonthSchedule> for MonthSchedule[src]

impl Serialize for MonthSchedule[src]

impl StructuralEq for MonthSchedule[src]

impl StructuralPartialEq for MonthSchedule[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.