Skip to content

Commit 4e5abe6

Browse files
authored
isYomTov() now returns true for 20 Nissan
Thanks Shai for catching this 11 year old bug.
1 parent db82893 commit 4e5abe6

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

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

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Zmanim Java API
3-
* Copyright (C) 2011 - 2023 Eliyahu Hershfeld
3+
* Copyright (C) 2011 - 2024 Eliyahu Hershfeld
44
* Copyright (C) September 2002 Avrom Finkelstien
55
* Copyright (C) 2019 - 2022 Y Paritcher
66
*
@@ -26,7 +26,7 @@
2626

2727
/**
2828
* The JewishCalendar extends the JewishDate class and adds calendar methods.
29-
* <p>
29+
*
3030
* This open source Java code was originally ported by <a href="http://www.facebook.com/avromf">Avrom Finkelstien</a>
3131
* from his C++ code. It was refactored to fit the KosherJava Zmanim API with simplification of the code, enhancements
3232
* and some bug fixing. The class allows setting whether the holiday and <em>parsha</em> scheme follows the Israel scheme
@@ -42,7 +42,7 @@
4242
* @see java.util.Calendar
4343
* @author &copy; Y. Paritcher 2019 - 2022
4444
* @author &copy; Avrom Finkelstien 2002
45-
* @author &copy; Eliyahu Hershfeld 2011 - 2023
45+
* @author &copy; Eliyahu Hershfeld 2011 - 2024
4646
*/
4747
public class JewishCalendar extends JewishDate {
4848
/** The 14th day of Nissan, the day before Pesach (Passover).*/
@@ -387,9 +387,8 @@ public boolean isBirkasHachamah() {
387387
* Rosh Hashana as 1, we have to add 1 day for a total of 171. To this add a day since the tekufah is on a Tuesday
388388
* night, and we push off the bracha to Wednesday morning resulting in the 172 used in the calculation.
389389
*/
390-
// 28 years of 365.25 days + the offset from molad tohu mentioned above
391-
return elapsedDays % (28 * 365.25) == 172;
392-
}
390+
return elapsedDays % (28 * 365.25) == 172; // 28 years of 365.25 days + the offset from molad tohu mentioned above
391+
}
393392

394393
/**
395394
* Return the type of year for <em>parsha</em> calculations. The algorithm follows the
@@ -704,7 +703,7 @@ public int getYomTovIndex() {
704703
if (day == 15 || (day == 16 && !inIsrael)) {
705704
return SUCCOS;
706705
}
707-
if (day >= 17 && day <= 20 || day == 16) {
706+
if (day >= 16 && day <= 20) {
708707
return CHOL_HAMOED_SUCCOS;
709708
}
710709
if (day == 21) {
@@ -785,7 +784,7 @@ public int getYomTovIndex() {
785784
/**
786785
* Returns true if the current day is <em>Yom Tov</em>. The method returns true even for holidays such as {@link #CHANUKAH}
787786
* and minor ones such as {@link #TU_BEAV} and {@link #PESACH_SHENI}. <em>Erev Yom Tov</em> (with the exception of
788-
* {@link #HOSHANA_RABBA}, and <em>erev</em> the second days of {@link #PESACH}) returns false, as do {@link #isTaanis() fast
787+
* {@link #HOSHANA_RABBA} and <em>erev</em> the second days of {@link #PESACH}) returns false, as do {@link #isTaanis() fast
789788
* days} besides {@link #YOM_KIPPUR}. Use {@link #isAssurBemelacha()} to find the days that have a prohibition of work.
790789
*
791790
* @return true if the current day is a Yom Tov
@@ -799,7 +798,7 @@ public int getYomTovIndex() {
799798
*/
800799
public boolean isYomTov() {
801800
int holidayIndex = getYomTovIndex();
802-
if ((isErevYomTov() && (holidayIndex != HOSHANA_RABBA || (holidayIndex == CHOL_HAMOED_PESACH && getJewishDayOfMonth() != 20)))
801+
if ((isErevYomTov() && (holidayIndex != HOSHANA_RABBA && holidayIndex != CHOL_HAMOED_PESACH))
803802
|| (isTaanis() && holidayIndex != YOM_KIPPUR) || holidayIndex == ISRU_CHAG) {
804803
return false;
805804
}
@@ -1065,9 +1064,8 @@ public boolean isYomKippurKatan() {
10651064
if (day == 29 && dayOfWeek != Calendar.FRIDAY && dayOfWeek != Calendar.SATURDAY) {
10661065
return true;
10671066
}
1068-
1069-
return (day == 27 || day == 28) && dayOfWeek == Calendar.THURSDAY;
1070-
}
1067+
return (day == 27 || day == 28) && dayOfWeek == Calendar.THURSDAY;
1068+
}
10711069

10721070
/**
10731071
* The Monday, Thursday and Monday after the first <em>Shabbos</em> after {@link #isRoshChodesh() <em>Rosh Chodesh</em>}
@@ -1084,8 +1082,8 @@ public boolean isBeHaB() {
10841082
int day = getJewishDayOfMonth();
10851083

10861084
if (month == JewishDate.CHESHVAN || month == JewishDate.IYAR) {
1087-
return (dayOfWeek == Calendar.MONDAY && day > 4 && day < 18)
1088-
|| (dayOfWeek == Calendar.THURSDAY && day > 7 && day < 14);
1085+
return (dayOfWeek == Calendar.MONDAY && day > 4 && day < 18)
1086+
|| (dayOfWeek == Calendar.THURSDAY && day > 7 && day < 14);
10891087
}
10901088
return false;
10911089
}
@@ -1419,7 +1417,7 @@ public int getTekufasTishreiElapsedDays() {
14191417
public boolean isVeseinTalUmatarStartDate() {
14201418
if (inIsrael) {
14211419
// The 7th Cheshvan can't occur on Shabbos, so always return true for 7 Cheshvan
1422-
return getJewishMonth() == CHESHVAN && getJewishDayOfMonth() == 7;
1420+
return getJewishMonth() == CHESHVAN && getJewishDayOfMonth() == 7;
14231421
} else {
14241422
if (getDayOfWeek() == Calendar.SATURDAY) { //Not recited on Friday night
14251423
return false;
@@ -1430,7 +1428,7 @@ public boolean isVeseinTalUmatarStartDate() {
14301428
return getTekufasTishreiElapsedDays() == 47;
14311429
}
14321430
}
1433-
}
1431+
}
14341432

14351433
/**
14361434
* Returns true if tonight is the first night to start reciting <em>Vesein Tal Umatar Livracha</em> (
@@ -1453,7 +1451,7 @@ public boolean isVeseinTalUmatarStartDate() {
14531451
public boolean isVeseinTalUmatarStartingTonight() {
14541452
if (inIsrael) {
14551453
// The 7th Cheshvan can't occur on Shabbos, so always return true for 6 Cheshvan
1456-
return getJewishMonth() == CHESHVAN && getJewishDayOfMonth() == 6;
1454+
return getJewishMonth() == CHESHVAN && getJewishDayOfMonth() == 6;
14571455
} else {
14581456
if (getDayOfWeek() == Calendar.FRIDAY) { //Not recited on Friday night
14591457
return false;
@@ -1464,7 +1462,7 @@ public boolean isVeseinTalUmatarStartingTonight() {
14641462
return getTekufasTishreiElapsedDays() == 46;
14651463
}
14661464
}
1467-
}
1465+
}
14681466

14691467
/**
14701468
* Returns if <em>Vesein Tal Umatar Livracha</em> (<em>Sheailas Geshamim</em>) is recited. This will return

0 commit comments

Comments
 (0)