Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,47 @@ public boolean isBirkasHachamah() {
return false;
}

/**
* Tekufas Shmuel: a solar year is 365.25 days.
* notation: days,hours,chalakim
* molad BaHaRad was 2D,5H,204C
* or 5H,204C from the start of rosh hashana year 1
* molad nissan add 177D,4H,438C (6 * 29D,12H,793C)
* or 177D,9H,642C after rosh hashana year 1
* tekufas nissan was 7D,9H,642C before molad nissan ~rambam.
* or 170D,0H,0C after rosh hashana year 1
* tekufas tishrei was 182D,3H (365.25 / 2) before tekufas nissan
* or 12D,15H before Rosh Hashana year 1
* outside of EY we say Tal Umatar in Birkas Hashanim from 60 days after tekufas tishrei.
* 60 includes the day of the tekufah and the day we start.
* 60 days from the tekufah == 47D,9H from Rosh Hashana year 1
*/
private int tekufasTishreiElapsedDays() {
// days since Rosh Hashana year 1
// add 1/2 day as the first tekufas tishrei was 9 hours into the day
// this allows all 4 years of the secular leap year cycle to share 47 days
// make from 47D,9H to 47D for simplicity
double days = getJewishCalendarElapsedDays(getJewishYear()) + (getDaysSinceStartOfJewishYear()-1) + .5;
// days of completed solar years
double solar = (getJewishYear()-1)*365.25;
return (int) (days - solar);
}

public boolean isBirchasHashanimToday() {
if (inIsrael && getJewishMonth() == 7 && getJewishDayOfMonth() == 7) return true;
else return tekufasTishreiElapsedDays() == 47;
}

public boolean getBirchasHashanim() {
Comment thread
KosherJava marked this conversation as resolved.
if (getJewishMonth() == 1 && getJewishDayOfMonth() < 15) return true;
if (getJewishMonth() < 7) return false;
if (inIsrael) {
return getJewishMonth() != 7 || getJewishDayOfMonth() >= 7;
} else {
return tekufasTishreiElapsedDays() >= 47;
}
}

/**
* Return the type of year for parsha calculations. The algorithm follows the
* <a href="http://hebrewbooks.org/pdfpager.aspx?req=14268&amp;st=&amp;pgnum=222">Luach Arba'ah Shearim</a> in the Tur Ohr Hachaim.
Expand Down Expand Up @@ -933,6 +974,58 @@ public Daf getDafYomiYerushalmi() {
}


public boolean isMashivHaruachStarts() {
return getJewishMonth() == 7 && getJewishDayOfMonth() == 22;
}

public boolean isMashivHaruachEnds() {
return getJewishMonth() == 1 && getJewishDayOfMonth() == 15;
}

public boolean isMashivHaruach() {
JewishDate startDate = new JewishDate(getJewishYear(), 7, 22);
JewishDate endDate = new JewishDate(getJewishYear(), 1, 15);
return compareTo(startDate) > 0 && compareTo(endDate) < 0;
}

public boolean isMoridHatal() {
return !isMashivHaruach() || isMashivHaruachStarts() || isMashivHaruachEnds();
}

/**
* This presumes the evenings of December 4/5 are always the initial start date outside of Israel
* Because the jewish date does not auto-increment in the evening, we use December 5/6 as the start date
* and rely on the user to increment the jewish date after nightfall.
* Note that according to many, the date for Vesein Tal Umatar is tied to the Julian calendar and has historically
* moved over time as the deviance from the Gregorian calendar increases. The date of December 4/5 is to be used
* for the 20th and 21st century.
*/
public boolean isVeseinTalUmatar() {
JewishDate startDate = getGregorianVeseinTalUmatarStart();
JewishDate endDate = new JewishDate(getJewishYear(), 1, 15);
return compareTo(startDate) > 0 && compareTo(endDate) < 0;
}

public boolean isVeseinTalUmatarStartsTonight() {
JewishDate startDate = getGregorianVeseinTalUmatarStart();
JewishDate prevDate = getGregorianVeseinTalUmatarStart();
prevDate.back();
return (getDayOfWeek() == 7 && equals(startDate)) || (getDayOfWeek() != 6 || equals(prevDate));
}

public boolean isVeseinBeracha() {
return !isVeseinTalUmatar();
}

public JewishDate getGregorianVeseinTalUmatarStart() {
JewishDate startDate = new JewishDate(getJewishYear(), 8, 7);
if (inIsrael) {
startDate.setGregorianDate(startDate.getGregorianYear(), 12, isGregorianLeapYear(startDate.getGregorianYear()+1)?6:5);
}
return startDate;
}


/**
* @see Object#equals(Object)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,10 @@ int getLastDayOfGregorianMonth(int month) {
return getLastDayOfGregorianMonth(month, gregorianYear);
}

boolean isGregorianLeapYear(int year) {
return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
}

/**
* The month, where 1 == January, 2 == February, etc... Note that this is different than the Java's Calendar class
* where January ==0
Expand Down