@@ -142,7 +142,7 @@ public class JewishCalendar extends JewishDate {
142
142
public static final int YOM_KIPPUR_KATAN = 36 ;
143
143
144
144
/**
145
- * The Monday, Thursday and Monday after the first <em>Shabbos</em> after <em>Rosh Chodesh Cheshvan</em> and <em>Iyar</em>em> ) are BeHab
145
+ * The Monday, Thursday and Monday after the first <em>Shabbos</em> after <em>Rosh Chodesh Cheshvan</em> and <em>Iyar</em>) are BeHab
146
146
* days. This constant is not actively in use.
147
147
* @see #isBeHaB()
148
148
*/
@@ -472,6 +472,29 @@ public Parsha getParshah() {
472
472
}
473
473
return Parsha .NONE ; //keep the compiler happy
474
474
}
475
+
476
+ /**
477
+ * Returns the upcoming {@link Parsha <em>Parsha</em>} regardless of if it is the weekday or <em>Shabbos</em> (where next
478
+ * Shabbos's <em>Parsha</em> will be returned. This is unlike {@link #getParshah()} that returns {@link Parsha#NONE} if
479
+ * the date is not <em>Shabbos</em>. If the upcoming Shabbos is a <em>Yom Tov</em> and has no <em>Parsha</em>, the
480
+ * following week's <em>Parsha</em> will be returned.
481
+ *
482
+ * @return the upcoming <em>parsha</em>.
483
+ */
484
+ public Parsha getUpcomingParshah () {
485
+ JewishCalendar clone = (JewishCalendar ) clone ();
486
+ int daysToShabbos = (Calendar .SATURDAY - getDayOfWeek () + 7 ) % 7 ;
487
+ if (getDayOfWeek () != Calendar .SATURDAY ) {
488
+ clone .forward (Calendar .DATE , daysToShabbos );
489
+ } else {
490
+ clone .forward (Calendar .DATE , 7 );
491
+ }
492
+ while (clone .getParshah () == Parsha .NONE ) { //Yom Kippur / Sukkos or Pesach with 2 potential non-parsha Shabbosim in a row
493
+ clone .forward (Calendar .DATE , 7 );
494
+ }
495
+ return clone .getParshah ();
496
+ }
497
+
475
498
476
499
/**
477
500
* Returns a {@link Parsha <em>Parsha</em>} enum if the <em>Shabbos</em> is one of the four <em>parshiyos</em> of {@link
0 commit comments