Skip to content

Commit d5da422

Browse files
authored
add isYomKippurKatan
1 parent d8234b8 commit d5da422

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/main/java/com/kosherjava/zmanim/hebrewcalendar/JewishCalendar.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ public class JewishCalendar extends JewishDate {
133133

134134
/** The day following the last day of Pesach, Shavuos and Sukkos.*/
135135
public static final int ISRU_CHAG = 35;
136+
137+
/**
138+
* The day before <em>Rosh Chodesh</em> (moved to Thursday if <em>Rosh Chodesh</em> is on a Friday or <em>Shabbos</em>) in most months.
139+
* This constant is not actively in use.
140+
* @see #isYomKippurKatan()
141+
*/
142+
public static final int YOM_KIPPUR_KATAN = 36;
136143

137144
/**
138145
* Is the calendar set to Israel, where some holidays have different rules.
@@ -846,6 +853,33 @@ public boolean isErevRoshChodesh() {
846853
// Erev Rosh Hashana is not Erev Rosh Chodesh.
847854
return (getJewishDayOfMonth() == 29 && getJewishMonth() != ELUL);
848855
}
856+
857+
858+
/**
859+
* Returns true if the current day is <em>Yom Kippur Katan</em>. Returns false for <em>Erev Rosh Hashana</em>,
860+
* <em>Erev Rosh Chodesh Cheshvan</em>, <em>Teves</em> and <em>Iyyar</em>. If <em>Erev Rosh Chodesh</em> occurs
861+
* on a Friday or <em>Shabbos</em>, <em>Yom Kippur Katan</em> is moved back to Thursday.
862+
*
863+
* @return true if the current day is <em>Erev Rosh Chodesh</em>. Returns false for <em>Erev Rosh Hashana</em>.
864+
* @see #isRoshChodesh()
865+
*/
866+
public boolean isYomKippurKatan() {
867+
int dayOfWeek = getDayOfWeek();
868+
int month = getJewishMonth();
869+
int day = getJewishDayOfMonth();
870+
if(month == JewishDate.ELUL || month == JewishDate.TISHREI && month != JewishDate.KISLEV && month != JewishDate.NISSAN) {
871+
return false;
872+
}
873+
874+
if(day == 29 && dayOfWeek != Calendar.FRIDAY && dayOfWeek != Calendar.SATURDAY) {
875+
return true;
876+
}
877+
878+
if((day == 27 || day == 28) && dayOfWeek == Calendar.THURSDAY ) {
879+
return true;
880+
}
881+
return false;
882+
}
849883

850884
/**
851885
* Return true if the day is a Taanis (fast day). Return true for <em>17 of Tammuz</em>, <em>Tisha B'Av</em>,

0 commit comments

Comments
 (0)