Eruv Tavshilin implemenation
PupaRebbe opened this issue · 1 comments
PupaRebbe commented
Not sure which class should implement this, probably HebrewCalendar.
Here is the code:
function eruvTavshilin(dt, il){
if(dt.getDay() <3 || dt.getDay() >4) return false;
const today = new HDate(dt);
const friday = today.after(5), tomorrow = today.next();
if(!isChag(friday, il) || isChag(today, il) || !isChag(tomorrow, il)) return false;
return true;
}
function isChag(dt, il){
const options = {
start: dt,
end: dt,
mask: flags.CHAG,
il: il
};
const events = HebrewCalendar.calendar(options);
return Boolean(events.length);
}
mjradwin commented
Added to 5.4.0
HebrewCalendar.eruvTavshilin(date, il) ⇒ boolean
Eruv Tavshilin
Kind: static method of HebrewCalendar
Param | Type |
---|---|
date | Date | HDate |
il | boolean |