[−][src]Enum heca_lib::prelude::MonthSchedule
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
impl Clone for MonthSchedule
[src]
fn clone(&self) -> MonthSchedule
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for MonthSchedule
[src]
impl Debug for MonthSchedule
[src]
impl<'de> Deserialize<'de> for MonthSchedule
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Eq for MonthSchedule
[src]
impl PartialEq<MonthSchedule> for MonthSchedule
[src]
fn eq(&self, other: &MonthSchedule) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for MonthSchedule
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralEq for MonthSchedule
[src]
impl StructuralPartialEq for MonthSchedule
[src]
Auto Trait Implementations
impl RefUnwindSafe for MonthSchedule
impl Send for MonthSchedule
impl Sync for MonthSchedule
impl Unpin for MonthSchedule
impl UnwindSafe for MonthSchedule
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,