Skip to content

Commit ee3347b

Browse files
authored
Add ability to format a parsha even during the week
Closes #220 and closes #221. Thanks @hersheytabakllc
1 parent 2cde426 commit ee3347b

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

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

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -899,15 +899,15 @@ public String formatDafYomiBavli(Daf daf) {
899899
public String formatDafYomiYerushalmi(Daf daf) {
900900
if(daf == null) {
901901
if (hebrewFormat) {
902-
return Daf.getYerushlmiMasechtos()[39];
902+
return Daf.getYerushalmiMasechtos()[39];
903903
} else {
904-
return Daf.getYerushlmiMasechtosTransliterated()[39];
904+
return Daf.getYerushalmiMasechtosTransliterated()[39];
905905
}
906906
}
907907
if (hebrewFormat) {
908908
return daf.getYerushalmiMasechta() + " " + formatHebrewNumber(daf.getDaf());
909909
} else {
910-
return daf.getYerushlmiMasechtaTransliterated() + " " + daf.getDaf();
910+
return daf.getYerushalmiMasechtaTransliterated() + " " + daf.getDaf();
911911
}
912912
}
913913

@@ -1036,8 +1036,11 @@ public void setTransliteratedParshiosList(EnumMap<JewishCalendar.Parsha, String>
10361036
}
10371037

10381038
/**
1039-
* Returns a String with the name of the current parsha(ios). If the formatter is set to format in Hebrew, returns
1040-
* a string of the current parsha(ios) in Hebrew for example &#x05D1;&#x05E8;&#x05D0;&#x05E9;&#x05D9;&#x05EA; or
1039+
* Returns a String with the name of the current parsha(ios). This method gets the current <em>parsha</em> by
1040+
* calling {@link JewishCalendar#getParshah()} that does not return a <em>parsha</em> for any non-<em>Shabbos</em>
1041+
* or a <em>Shabbos</em> that occurs on a <em>Yom Tov</em>, and will return an empty <code>String</code> in those
1042+
* cases. If the class {@link #isHebrewFormat() is set to format in Hebrew} it will return a <code>String</code>
1043+
* of the current parsha(ios) in Hebrew for example &#x05D1;&#x05E8;&#x05D0;&#x05E9;&#x05D9;&#x05EA; or
10411044
* &#x05E0;&#x05E6;&#x05D1;&#x05D9;&#x05DD; &#x05D5;&#x05D9;&#x05DC;&#x05DA; or an empty string if there
10421045
* are none. If not set to Hebrew, it returns a string of the parsha(ios) transliterated into Latin chars. The
10431046
* default uses Ashkenazi pronunciation in typical American English spelling, for example Bereshis or
@@ -1050,9 +1053,32 @@ public void setTransliteratedParshiosList(EnumMap<JewishCalendar.Parsha, String>
10501053
* there are none. If not set to Hebrew, it returns a string of the parsha(ios) transliterated into Latin
10511054
* chars. The default uses Ashkenazi pronunciation in typical American English spelling, for example
10521055
* Bereshis or Nitzavim Vayeilech or an empty string if there are none.
1056+
* @see #formatParsha(JewishCalendar)
1057+
* @see #isHebrewFormat()
1058+
* @see JewishCalendar#getParshah()
10531059
*/
10541060
public String formatParsha(JewishCalendar jewishCalendar) {
10551061
JewishCalendar.Parsha parsha = jewishCalendar.getParshah();
1062+
return formatParsha(parsha);
1063+
}
1064+
1065+
/**
1066+
* Returns a String with the name of the current parsha(ios). This method overloads {@link
1067+
* HebrewDateFormatter#formatParsha(JewishCalendar)} and unlike that method, it will format the <em>parsha</em> passed
1068+
* to this method regardless of the day of week. This is the way to format a <em>parsha</em> retrieved from calling
1069+
* {@link JewishCalendar#getUpcomingParshah()}.
1070+
*
1071+
* @param parsha a JewishCalendar.Parsha object
1072+
* @return today's parsha(ios) in Hebrew for example, if the formatter is set to format in Hebrew, returns a string
1073+
* of the current parsha(ios) in Hebrew for example &#x05D1;&#x05E8;&#x05D0;&#x05E9;&#x05D9;&#x05EA; or
1074+
* &#x05E0;&#x05E6;&#x05D1;&#x05D9;&#x05DD; &#x05D5;&#x05D9;&#x05DC;&#x05DA; or an empty string if
1075+
* there are none. If not set to Hebrew, it returns a string of the parsha(ios) transliterated into Latin
1076+
* chars. The default uses Ashkenazi pronunciation in typical American English spelling, for example
1077+
* Bereshis or Nitzavim Vayeilech or an empty string if there are none.
1078+
* @see #formatParsha(JewishCalendar)
1079+
*
1080+
*/
1081+
public String formatParsha(JewishCalendar.Parsha parsha) {
10561082
return hebrewFormat ? hebrewParshaMap.get(parsha) : transliteratedParshaMap.get(parsha);
10571083
}
10581084

0 commit comments

Comments
 (0)