HebrewDateFormatter class

The HebrewDateFormatter class formats a JewishDate.

The class formats Jewish dates, numbers, Daf Yomi (Bavli and Yerushalmi), the Omer, Parshas Hashavua (including special parshiyos such as Shekalim, Zachor, Parah, Hachodesh), Yomim Tovim and the Molad (experimental) in Hebrew or Latin chars, and has various settings. Sample full date output includes (using various options):

  • 21 Shevat, 5729
  • כא שבט תשכט
  • כ״א שבט ה׳ תשכ״ט
  • כ״א שבט תש״פ or כ״א שבט תש״ף
  • כ׳ שבט ו׳ אלפים

© Eliyahu Hershfeld 2011 - 2020

Constructors

HebrewDateFormatter()

Properties

hashCode → int
The hash code for this object.
no setterinherited
hebrewFormat ↔ bool
Sets the formatter to format in Hebrew in the various formatting methods.
getter/setter pair
hebrewMonths ↔ List<String>
getter/setter pair
hebrewOmerPrefix ↔ String
Hebrew Omer prefix. By default it is the letter ב, but can be set to ל (or any other prefix).
getter/setter pair
hebrewParshaMap ↔ Map<Parsha, String>
list of Hebrew parshiyos.
getter/setter pair
hebrewParshaPrefix ↔ String
getter/setter pair
hebrewShabbosEndPrefix ↔ String
getter/setter pair
hebrewShabbosStartPrefix ↔ String
getter/setter pair
hebrewYomTovEndPrefix ↔ String
getter/setter pair
hebrewYomTovStartPrefix ↔ String
getter/setter pair
longOmerFormat ↔ bool
getter/setter pair
longWeekFormat ↔ bool
Setting to control if the formatDayOfWeek will use the long format such as ראשון or short such as א when formatting the day of week in Hebrew.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
transliteratedHolidays ↔ List<String>
List of holidays transliterated into Latin chars. This is used by the formatYomTov(JewishCalendar) when formatting the Yom Tov String. The default list of months uses Ashkenazi pronunciation in typical American English spelling.
getter/setter pair
transliteratedMonths ↔ List<String>
List of months transliterated into Latin chars. The default list of months uses Ashkenazi pronunciation in typical American English spelling. This list has a length of 14 with 3 variations for Adar - "Adar", "Adar II", "Adar I"
getter/setter pair
transliteratedParshaMap ↔ Map<Parsha, String>
List of transliterated parshiyos using the default Ashkenazi pronounciation. The formatParsha method uses this for transliterated parsha formatting. This list can be overridden (for Sephardi English transliteration for example) by setting the setTransliteratedParshiosList. The list includes double and special parshiyos is set as "Bereshis, Noach, Lech Lecha, Vayera, Chayei Sara, Toldos, Vayetzei, Vayishlach, Vayeshev, Miketz, Vayigash, Vayechi, Shemos, Vaera, Bo, Beshalach, Yisro, Mishpatim, Terumah, Tetzaveh, Ki Sisa, Vayakhel, Pekudei, Vayikra, Tzav, Shmini, Tazria, Metzora, Achrei Mos, Kedoshim, Emor, Behar, Bechukosai, Bamidbar, Nasso, Beha'aloscha, Sh'lach, Korach, Chukas, Balak, Pinchas, Matos, Masei, Devarim, Vaeschanan, Eikev, Re'eh, Shoftim, Ki Seitzei, Ki Savo, Nitzavim, Vayeilech, Ha'Azinu, Vezos Habracha, Vayakhel Pekudei, Tazria Metzora, Achrei Mos Kedoshim, Behar Bechukosai, Chukas Balak, Matos Masei, Nitzavim Vayeilech, Shekalim, Zachor, Parah, Hachodesh".
getter/setter pair
transliteratedParshaPrefix ↔ String
getter/setter pair
transliteratedShabbosDayOfWeek ↔ String
day of Shabbos transliterated into Latin chars. The default uses Ashkenazi pronunciation "Shabbos".
getter/setter pair
transliteratedShabbosEndPrefix ↔ String
getter/setter pair
transliteratedShabbosStartPrefix ↔ String
getter/setter pair
transliteratedYomTovEndPrefix ↔ String
getter/setter pair
transliteratedYomTovStartPrefix ↔ String
getter/setter pair
useFinalFormLetters ↔ bool
Returns whether the class is set to use the מנצפ״ך letters when formatting years ending in 20, 40, 50, 80 and 90 to produce תש״פ if false or or תש״ף if true. Traditionally non-final form letters are used, so the year 5780 would be formatted as תש״פ if the default false is used here. If this returns true, the format תש״ף would be used.
getter/setter pair
useGershGershayim ↔ bool
Sets whether to use the Geresh ׳ and Gershayim ״ in formatting Hebrew dates and numbers. The default value is true and output would look like כ״א שבט תש״כ (or כ״א שבט תש״ך). When set to false, this output would display as כא שבט תשכ (or כא שבט תשך). Single digit days or month or years such as כ׳ שבט ו׳ אלפים show the use of the Geresh.
getter/setter pair
useLongHebrewYears ↔ bool
When formatting a Hebrew Year, traditionally the thousands digit is omitted and output for a year such as 5729 (1969 Gregorian) would be calculated for 729 and format as תשכ״ט. This method allows setting this to true to return the long format year such as ה׳ תשכ״ט for 5729/1969.
getter/setter pair
useShortHolidayFormat ↔ bool
getter/setter pair

Methods

format(JewishDate jewishDate, {String pattern = 'dd MM yy'}) → String
Formats the Jewish date. The default format is "day Month year", for example if the formatter is set to Hebrew it will כ״א שבט תשכ״ט, and the format "21 Shevat, 5729" if not. The format can be change by pattern variable. The following symbol are available in explicit patterns:
formatDafYomiBavli(Daf daf) → String
Formats the Daf Yomi Bavli in the format of "עירובין נ״ב" in hebrewFormat, or the transliterated format of "Eruvin 52".
formatDafYomiYerushalmi(Daf daf) → String
Formats the Daf Yomi Yerushalmi in the format of "עירובין נ״ב" in isHebrewFormat, or the transliterated format of "Eruvin 52".
formatDayOfWeek(JewishDate jewishDate) → String
Formats the day of week. If isHebrewFormat is set, it will display in the format ראשון etc. If Hebrew formatting is not in use it will return it in the format of Sunday etc. There are various formatting options that will affect the output.
formatErevRoshChodesh(JewishCalendar jewishCalendar) → String
Formats a day as Erev Rosh Chodesh in the format of in the format of ערב ראש חודש שבט or Rosh Chodesh Shevat. If it is not Erev Rosh Chodesh, an empty String will be returned.
formatHebrewNumber(int number) → String
Returns a Hebrew formatted string of a number. The method can calculate from 0 - 9999.
formatMolad(double moladChalakim) → String
Experimental and incomplete
formatMonth(JewishDate jewishDate) → String
Returns a string of the current Hebrew month such as "Tishrei". Returns a string of the current Hebrew month such as "אדר ב׳".
formatOmer(JewishCalendar jewishCalendar) → String
Returns a String of the Omer day in the form ל״ג בעומר if Hebrew Format is set, or "Omer X" or "Lag BaOmer" if not. An empty string if there is no Omer this day.
formatParsha(JewishCalendar jewishCalendar) → String
Returns a String with the name of the current parsha(ios). If the formatter is set to format in Hebrew, returns a string of the current parsha(ios) in Hebrew for example בראשית or ניצבים וילך or an empty string if there are none. If not set to Hebrew, it returns a string of the parsha(ios) transliterated into Latin chars. The default uses Ashkenazi pronunciation in typical American English spelling, for example Bereshis or Nitzavim Vayeilech or an empty string if there are none.
formatRoshChodesh(JewishCalendar jewishCalendar) → String
Formats a day as Rosh Chodesh in the format of in the format of ראש חודש שבט or Rosh Chodesh Shevat. If it is not Rosh Chodesh, an empty String will be returned.
formatSpecialParsha(JewishCalendar jewishCalendar) → String
Returns a String with the name of the current special parsha of Shekalim, Zachor, Parah or Hachodesh or an empty String for a non-special parsha. If the formatter is set to format in Hebrew, it returns a string of the current special parsha in Hebrew, for example שקלים, זכור פרה or החדש. An empty string if the date is not a special parsha. If not set to Hebrew, it returns a string of the special parsha transliterated into Latin chars. The default uses Ashkenazi pronunciation in typical American English spelling Shekalim, Zachor, Parah or Hachodesh.
formatWeeklyParsha(JewishCalendar jewishCalendar) → String
Returns a String with the name of the current parsha(ios) on this week. If the formatter is set to format in Hebrew, returns a string of the parsha(ios) in Hebrew for example בראשית or ניצבים וילך. If not set to Hebrew, it returns a string of the parsha(ios) transliterated into Latin chars. The default uses Ashkenazi pronunciation in typical American English spelling, for example Bereshis or Nitzavim Vayeilech.
formatYomTov(JewishCalendar jewishCalendar) → String
Formats the Yom Tov (holiday) in Hebrew or transliterated Latin characters.
getEvent(JewishCalendar jewishCalendar) → String
getEventsList(JewishCalendar jewishCalendar, ComplexZmanimCalendar complexZmanimCalendar, {int maxEvents = 9}) → List<String>
getFormattedKviah(int jewishYear) → String
Returns the kviah in the traditional 3 letter Hebrew format where the first letter represents the day of week of Rosh Hashana, the second letter represents the lengths of Cheshvan and Kislev (JewishDate.SHELAIMIM , JewishDate.KESIDRAN or JewishDate.CHASERIM) and the 3rd letter represents the day of week of Pesach. For example 5729 (1969) would return בשה (Rosh Hashana on Monday, Shelaimim, and Pesach on Thursday), while 5771 (2011) would return השג (Rosh Hashana on Thursday, Shelaimim, and Pesach on Tuesday).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited