diff --git a/src/main/java/com/kosherjava/zmanim/hebrewcalendar/JewishCalendar.java b/src/main/java/com/kosherjava/zmanim/hebrewcalendar/JewishCalendar.java index 2bc86440..df940221 100644 --- a/src/main/java/com/kosherjava/zmanim/hebrewcalendar/JewishCalendar.java +++ b/src/main/java/com/kosherjava/zmanim/hebrewcalendar/JewishCalendar.java @@ -506,6 +506,38 @@ public Parsha getParshah() { } return Parsha.NONE; //keep the compiler happy } + + /** + * Returns this week's {@link Parsha Parsha} regardless of if it is the weekday or Shabbos (where next + * Shabbos's Parsha will be returned. If the upcoming Shabbos is a Yom Tov and has no Parsha, + * {@link Parsha#NONE} will be returned. + * + * @return the upcoming parsha. + */ + public Parsha getThisWeeksParshah() { + JewishCalendar clone = (JewishCalendar) clone(); + int daysToShabbos = (Calendar.SATURDAY - getDayOfWeek() + 7) % 7; + if (getDayOfWeek() != Calendar.SATURDAY) { + clone.forward(Calendar.DATE, daysToShabbos); + } + return clone.getParshah(); + } + + /** + * Returns this week's {@link #getSpecialShabbos() special shabbos} regardless of if it is the weekday or Shabbos (where next + * Shabbos's Parsha will be returned. If the upcoming Shabbos is a Yom Tov and has no Parsha + * or special shabbos, {@link Parsha#NONE} will be returned. + * + * @return the upcoming parsha. + */ + public Parsha getThisWeeksSpecialParshah() { + JewishCalendar clone = (JewishCalendar) clone(); + int daysToShabbos = (Calendar.SATURDAY - getDayOfWeek() + 7) % 7; + if (getDayOfWeek() != Calendar.SATURDAY) { + clone.forward(Calendar.DATE, daysToShabbos); + } + return clone.getSpecialShabbos(); + } /** * Returns the upcoming {@link Parsha Parsha} regardless of if it is the weekday or Shabbos (where next @@ -517,7 +549,7 @@ public Parsha getParshah() { */ public Parsha getUpcomingParshah() { JewishCalendar clone = (JewishCalendar) clone(); - int daysToShabbos = (Calendar.SATURDAY - getDayOfWeek() + 7) % 7; + int daysToShabbos = (Calendar.SATURDAY - getDayOfWeek() + 7) % 7; if (getDayOfWeek() != Calendar.SATURDAY) { clone.forward(Calendar.DATE, daysToShabbos); } else {