import { Daf } from './Daf'; import { JewishDate } from './JewishDate'; import { JewishCalendar, Parsha } from './JewishCalendar'; /** * The HebrewDateFormatter class formats a {@link JewishDate}. * * The class formats Jewish dates, numbers, Daf Yomi (Bavli and Yerushalmi), the Omer, * Parshas Hashavua, (including special parshiyos of Shekalim, Zachor, Parah, * and Hachodesh), Yomim Tovim and the Molad (experimental) in Hebrew or Latin chars, and has various settings. * Sample full date output includes (using various options): * * * @see JewishDate * @see JewishCalendar * * @author © Eliyahu Hershfeld 2011 - 2015 */ export declare class HebrewDateFormatter { /** * See {@link #isHebrewFormat()} and {@link #setHebrewFormat(boolean)}. */ private hebrewFormat; /** * See {@link #isUseLongHebrewYears()} and {@link #setUseLongHebrewYears(boolean)}. */ private useLonghebrewYears; /** * See {@link #isUseGershGershayim()} and {@link #setUseGershGershayim(boolean)}. */ private useGershGershayim; /** * See {@link #isLongWeekFormat()} and {@link #setLongWeekFormat(boolean)}. */ private longWeekFormat; /** * See {@link #isUseFinalFormLetters()} and {@link #setUseFinalFormLetters(boolean)}. */ private useFinalFormLetters; /** * The internal DateFormat.  See {@link #isLongWeekFormat()} and {@link #setLongWeekFormat(boolean)}. */ private weekFormat; /** * 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 {@link #setTransliteratedParshiosList(EnumMap)}.  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,Shuva, Shira, Hagadol, Chazon, Nachamu". * * @see #formatParsha(JewishCalendar) */ private transliteratedParshaMap; /** * Unicode {@link Record} of Hebrew parshiyos.  The list includes double and special parshiyos and * contains "בראשית, נח, לך לך, * וירא, חיי שרה, * תולדות, ויצא, וישלח, * וישב, מקץ, ויגש, ויחי, * שמות, וארא, בא, בשלח, * יתרו, משפטים, תרומה, * תצוה, כי תשא, ויקהל, * פקודי, ויקרא, צו, * שמיני, תזריע, מצרע, * אחרי מות, קדושים, * אמור, בהר, בחקתי, * במדבר, נשא, בהעלתך, * שלח לך, קרח, חוקת, בלק, * פינחס, מטות, מסעי, * דברים, ואתחנן, עקב, * ראה, שופטים, כי תצא, * כי תבוא, D9;צבים, וילך, * האזינו, וזאת הברכה, * ויקהל פקודי, תזריע * מצרע, אחרי מות * קדושים, בהר בחקתי, * חוקת בלק, מטות מסעי, * נצבים וילך, שקלים, * זכור, פרה, החדש, * שובה,שירה,הגדול, * חזון,נחמו" */ private readonly hebrewParshaMap; /** * returns if the {@link #formatDayOfWeek(JewishDate)} will use the long format such as * ראשון or short such as א when formatting the day of week in * {@link #isHebrewFormat() Hebrew}. * * @return the longWeekFormat * @see #setLongWeekFormat(boolean) * @see #formatDayOfWeek(JewishDate) */ isLongWeekFormat(): boolean; /** * Setting to control if the {@link #formatDayOfWeek(JewishDate)} will use the long format such as * ראשון or short such as א when formatting the day of week in * {@link #isHebrewFormat() Hebrew}. * * @param longWeekFormat * the longWeekFormat to set */ setLongWeekFormat(longWeekFormat: boolean): void; /** * The gersh character is the ׳ char * that is similar to a single quote and is used in formatting Hebrew numbers. */ private static readonly GERESH; /** * The gershyim character is the ״ char * that is similar to a double quote and is used in formatting Hebrew numbers. */ private static readonly GERSHAYIM; /** * Transliterated month names.  Defaults to ["Nissan", "Iyar", "Sivan", "Tammuz", "Av", "Elul", "Tishrei", "Cheshvan", * "Kislev", "Teves", "Shevat", "Adar", "Adar II", "Adar I" ]. * @see #getTransliteratedMonthList() * @see #setTransliteratedMonthList(String[]) */ private transliteratedMonths; /** * The Hebrew omer prefix charachter. It defaults to ב producing בעומר, * but can be set to ל to produce לעומר (or any other prefix). * @see #getHebrewOmerPrefix() * @see #setHebrewOmerPrefix(String) */ private hebrewOmerPrefix; /** * The default value for formatting Shabbos (Saturday).  Defaults to Shabbos. * @see #getTransliteratedShabbosDayOfWeek() * @see #setTransliteratedShabbosDayOfWeek(String) */ private transliteratedShabbosDayOfWeek; /** * Returns the day of Shabbos transliterated into Latin chars. The default uses Ashkenazi pronunciation "Shabbos". * This can be overwritten using the {@link #setTransliteratedShabbosDayOfWeek(String)} * * @return the transliteratedShabbos. The default list of months uses Ashkenazi pronunciation "Shabbos". * @see #setTransliteratedShabbosDayOfWeek(String) * @see #formatDayOfWeek(JewishDate) */ getTransliteratedShabbosDayOfWeek(): string; /** * Setter to override the default transliterated name of "Shabbos" to alternate spelling such as "Shabbat" used by * the {@link #formatDayOfWeek(JewishDate)} * * @param transliteratedShabbos * the transliteratedShabbos to set * * @see #getTransliteratedShabbosDayOfWeek() * @see #formatDayOfWeek(JewishDate) */ setTransliteratedShabbosDayOfWeek(transliteratedShabbos: string): void; /** * See {@link #getTransliteratedHolidayList()} and {@link #setTransliteratedHolidayList(String[])}. */ private transliteratedHolidays; /** * Returns the array of holidays transliterated into Latin chars. This is used by the * {@link #formatYomTov(JewishCalendar)} when formatting the Yom Tov String. The default list of months uses * Ashkenazi pronunciation in typical American English spelling. * * @return the array of transliterated holidays. The default list is currently ["Erev Pesach", "Pesach", * "Chol Hamoed Pesach", "Pesach Sheni", "Erev Shavuos", "Shavuos", "Seventeenth of Tammuz", "Tishah B'Av", * "Tu B'Av", "Erev Rosh Hashana", "Rosh Hashana", "Fast of Gedalyah", "Erev Yom Kippur", "Yom Kippur", * "Erev Succos", "Succos", "Chol Hamoed Succos", "Hoshana Rabbah", "Shemini Atzeres", "Simchas Torah", * "Erev Chanukah", "Chanukah", "Tenth of Teves", "Tu B'Shvat", "Fast of Esther", "Purim", "Shushan Purim", * "Purim Katan", "Rosh Chodesh", "Yom HaShoah", "Yom Hazikaron", "Yom Ha'atzmaut", "Yom Yerushalayim", * "Lag B'Omer","Shushan Purim Katan", "Isru Chag"]. * * @see #setTransliteratedMonthList(String[]) * @see #formatYomTov(JewishCalendar) * @see #isHebrewFormat() */ getTransliteratedHolidayList(): string[]; /** * Sets the array of holidays transliterated into Latin chars. This is used by the * {@link #formatYomTov(JewishCalendar)} when formatting the Yom Tov String. * * @param transliteratedHolidays * the transliteratedHolidays to set. Ensure that the sequence exactly matches the list returned by the * default */ setTransliteratedHolidayList(transliteratedHolidays: string[]): void; /** * Hebrew holiday array in the following format.
["ערב פסח", * "פסח", "חול המועד * פסח", "פסח שני", "ערב * שבועות", "שבועות", * "שבעה עשר בתמוז", * "תשעה באב", * "ט״ו באב", * "ערב ראש השנה", * "ראש השנה", * "צום גדליה", * "ערב יום כיפור", * "יום כיפור", * "ערב סוכות", * "סוכות", * "חול המועד סוכות", * "הושענא רבה", * "שמיני עצרת", * "שמחת תורה", * "ערב חנוכה", * "חנוכה", "עשרה בטבת", * "ט״ו בשבט", * "תענית אסתר", * "פורים", * "שושן פורים", * "פורים קטן", * "ראש חודש", * "יום השואה", * "יום הזיכרון", * "יום העצמאות", * "יום ירושלים", * "ל״ג בעומר", * "שושן פורים קטן"] */ private static readonly hebrewHolidays; /** * Formats the Yom Tov (holiday) in Hebrew or transliterated Latin characters. * * @param jewishCalendar the JewishCalendar * @return the formatted holiday or an empty String if the day is not a holiday. * @see #isHebrewFormat() */ formatYomTov(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. * @param jewishCalendar the JewishCalendar * @return The formatted String in the format of ראש * חודש שבט or Rosh Chodesh Shevat. If it * is not Rosh Chodesh, an empty String will be returned. */ formatRoshChodesh(jewishCalendar: JewishCalendar): string; /** * Returns if the formatter is set to use Hebrew formatting in the various formatting methods. * * @return the hebrewFormat * @see #setHebrewFormat(boolean) * @see #format(JewishDate) * @see #formatDayOfWeek(JewishDate) * @see #formatMonth(JewishDate) * @see #formatOmer(JewishCalendar) * @see #formatParsha(JewishCalendar) * @see #formatYomTov(JewishCalendar) */ isHebrewFormat(): boolean; /** * Sets the formatter to format in Hebrew in the various formatting methods. * * @param hebrewFormat * the hebrewFormat to set * @see #isHebrewFormat() * @see #format(JewishDate) * @see #formatDayOfWeek(JewishDate) * @see #formatMonth(JewishDate) * @see #formatOmer(JewishCalendar) * @see #formatParsha(JewishCalendar) * @see #formatYomTov(JewishCalendar) */ setHebrewFormat(hebrewFormat: boolean): void; /** * Returns the Hebrew Omer prefix.  By default it is the letter ב producing * בעומר, but it can be set to ל to produce * לעומר (or any other prefix) using the {@link #setHebrewOmerPrefix(String)}. * * @return the hebrewOmerPrefix * * @see #hebrewOmerPrefix * @see #setHebrewOmerPrefix(String) * @see #formatOmer(JewishCalendar) */ getHebrewOmerPrefix(): string; /** * Method to set the Hebrew Omer prefix. By default it is the letter ב, but this allows setting it to a * ל (or any other prefix). * * @param hebrewOmerPrefix * the hebrewOmerPrefix to set. You can use the Unicode \u05DC to set it to ל. * @see #getHebrewOmerPrefix() * @see #formatOmer(JewishCalendar) */ setHebrewOmerPrefix(hebrewOmerPrefix: string): void; /** * Returns the array 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" * * @return the array of months beginning in Nissan and ending in "Adar", "Adar II", "Adar I". The default list is * currently ["Nissan", "Iyar", "Sivan", "Tammuz", "Av", "Elul", "Tishrei", "Cheshvan", "Kislev", "Teves", * "Shevat", "Adar", "Adar II", "Adar I"]. * @see #setTransliteratedMonthList(String[]) */ getTransliteratedMonthList(): string[]; /** * Setter method to allow overriding of the default list of months transliterated into Latin chars. The default * uses Ashkenazi American English transliteration. * * @param transliteratedMonths * an array of 14 month names that defaults to ["Nissan", "Iyar", "Sivan", "Tamuz", "Av", "Elul", "Tishrei", * "Heshvan", "Kislev", "Tevet", "Shevat", "Adar", "Adar II", "Adar I"]. * @see #getTransliteratedMonthList() */ setTransliteratedMonthList(transliteratedMonths: string[]): void; /** * Unicode list of Hebrew months in the following format ["\u05E0\u05D9\u05E1\u05DF","\u05D0\u05D9\u05D9\u05E8", * "\u05E1\u05D9\u05D5\u05DF","\u05EA\u05DE\u05D5\u05D6","\u05D0\u05D1","\u05D0\u05DC\u05D5\u05DC", * "\u05EA\u05E9\u05E8\u05D9","\u05D7\u05E9\u05D5\u05DF","\u05DB\u05E1\u05DC\u05D5","\u05D8\u05D1\u05EA", * "\u05E9\u05D1\u05D8","\u05D0\u05D3\u05E8","\u05D0\u05D3\u05E8 \u05D1","\u05D0\u05D3\u05E8 \u05D0"] * * @see #formatMonth(JewishDate) */ private hebrewMonths; /** * Unicode list of Hebrew days of week in the format of ["ראשון", * "שני","שלישי","רביעי", * "חמישי","ששי","שבת"] */ private static readonly hebrewDaysOfWeek; /** * Formats the day of week. If {@link #isHebrewFormat() Hebrew formatting} 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. * * @param jewishDate the JewishDate Object * @return the formatted day of week * @see #isHebrewFormat() * @see #isLongWeekFormat() */ formatDayOfWeek(jewishDate: JewishDate): string; /** * Returns whether the class is set to use the Geresh ׳ and Gershayim ״ in formatting Hebrew dates and * numbers. When true and output would look like כ״א שבט תש״כ * (or כ״א שבט תש״ך). When set to false, this output * would display as כא שבט תשכ. * * @return true if set to use the Geresh ׳ and Gershayim ״ in formatting Hebrew dates and numbers. */ isUseGershGershayim(): boolean; /** * 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. * * @param useGershGershayim * set this to false to omit the Geresh ׳ and Gershayim ״ in formatting */ setUseGershGershayim(useGershGershayim: boolean): void; /** * 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 * תש״ף 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. * * @return true if set to use final form letters when formatting Hebrew years. The default value is false. */ isUseFinalFormLetters(): boolean; /** * When formatting a Hebrew Year, traditionally years ending in 20, 40, 50, 80 and 90 are formatted using non-final * form letters for example תש״פ for the year 5780. Setting this to true (the default * is false) will use the final form letters for מנצפ״ך and will format * the year 5780 as תש״ף. * * @param useFinalFormLetters * Set this to true to use final form letters when formatting Hebrew years. */ setUseFinalFormLetters(useFinalFormLetters: boolean): void; /** * Returns whether the class is set to use the thousands digit when formatting. 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 תשכ״ט. When set to true the long format year such * as ה׳ תשכ״ט for 5729/1969 is returned. * * @return true if set to use the thousands digit when formatting Hebrew dates and numbers. */ isUseLongHebrewYears(): boolean; /** * 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. * * @param useLongHebrewYears * Set this to true to use the long formatting */ setUseLongHebrewYears(useLongHebrewYears: boolean): void; /** * Formats the Jewish date. If the formatter is set to Hebrew, it will format in the form, "day Month year" for * example כ״א שבט תשכ״ט, and the format * "21 Shevat, 5729" if not. * * @param jewishDate * the JewishDate to be formatted * @return the formatted date. If the formatter is set to Hebrew, it will format in the form, "day Month year" for * example כ״א שבט תשכ״ט, and the format * "21 Shevat, 5729" if not. */ format(jewishDate: JewishDate): string; /** * Returns a string of the current Hebrew month such as "Tishrei". Returns a string of the current Hebrew month such * as "אדר ב׳". * * @param jewishDate * the JewishDate to format * @return the formatted month name * @see #isHebrewFormat() * @see #setHebrewFormat(boolean) * @see #getTransliteratedMonthList() * @see #setTransliteratedMonthList(String[]) */ formatMonth(jewishDate: JewishDate): string; /** * Returns a String of the Omer day in the form ל״ג בעומר if * Hebrew Format is set, or "Omer X" or "Lag B'Omer" if not. An empty string if there is no Omer this day. * * @param jewishCalendar * the JewishCalendar to be formatted * * @return a String of the Omer day in the form or an empty string if there is no Omer this day. The default * formatting has a ב׳ prefix that would output בעומר, but this * can be set via the {@link #setHebrewOmerPrefix(String)} method to use a ל and output * ל״ג לעומר. * @see #isHebrewFormat() * @see #getHebrewOmerPrefix() * @see #setHebrewOmerPrefix(String) */ formatOmer(jewishCalendar: JewishCalendar): string; /** * Formats a molad. * TODO: Experimental and incomplete * * @param moladChalakim - the chalakim of the molad * @return the formatted molad. FIXME: define proper format in English and Hebrew. */ private static formatMolad; /** * 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 ({@link JewishDate#SHELAIMIM * Shelaimim} , {@link JewishDate#KESIDRAN Kesidran} or {@link JewishDate#CHASERIM 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). * * @param jewishYear * the Jewish year * @return the Hebrew String such as בשה for 5729 (1969) and השג for 5771 * (2011). */ getFormattedKviah(jewishYear: number): string; /** * Formats the Daf Yomi Bavli in the format of * "עירובין נ״ב" in {@link #isHebrewFormat() Hebrew}, * or the transliterated format of "Eruvin 52". * @param daf the Daf to be formatted. * @return the formatted daf. */ formatDafYomiBavli(daf: Daf): string; /** * Formats the Daf Yomi Yerushalmi in the format * of "עירובין נ״ב" in {@link #isHebrewFormat() Hebrew}, or * the transliterated format of "Eruvin 52". * * @param daf the Daf to be formatted. * @return the formatted daf. */ formatDafYomiYerushalmi(daf: Daf | null): string; /** * Returns a Hebrew formatted string of a number. The method can calculate from 0 to 9999. * * * @param num * the number to be formatted. It will trow an IllegalArgumentException if the number is < 0 or > 9999. * @return the Hebrew formatted number such as תשכ״ט * @see #isUseFinalFormLetters() * @see #isUseGershGershayim() * @see #isHebrewFormat() * */ formatHebrewNumber(num: number): string; /** * Returns the map of transliterated parshiyos used by this formatter. * * @return the map of transliterated Parshios */ getTransliteratedParshiosList(): Record; /** * Setter method to allow overriding of the default list of parshiyos transliterated into Latin chars. The * default uses Ashkenazi American English transliteration. * * @param transliteratedParshaMap * the transliterated Parshios as an EnumMap to set * @see #getTransliteratedParshiosList() */ setTransliteratedParshiosList(transliteratedParshaMap: Record): void; /** * Returns a String with the name of the current parsha(ios). This method gets the current parsha by * calling {@link JewishCalendar#getParshah()} that does not return a parsha for any non-Shabbos * or a Shabbos that occurs on a Yom Tov, and will return an empty String in those * cases. If the class {@link #isHebrewFormat() is set to format in Hebrew} it will return 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. * * @param jewishCalendar the JewishCalendar Object * @return today's parsha(ios) in Hebrew for example, 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. * @see #formatParsha(JewishCalendar) * @see #isHebrewFormat() * @see JewishCalendar#getParshah() */ formatParsha(jewishCalendar: JewishCalendar): string; /** * Returns a String with the name of the current parsha(ios). This method overloads {@link * HebrewDateFormatter#formatParsha(JewishCalendar)} and unlike that method, it will format the parsha passed * to this method regardless of the day of week. This is the way to format a parsha retrieved from calling * {@link JewishCalendar#getUpcomingParshah()}. * * @param parsha a JewishCalendar.Parsha object * @return today's parsha(ios) in Hebrew for example, 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. * @see #formatParsha(JewishCalendar) * @see JewishCalendar#getUpcomingParshah() */ formatParsha(parsha: Parsha): 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. * * @param jewishCalendar the JewishCalendar Object * @return today's special parsha. If the formatter is set to format in Hebrew, returns a string * of the current special parsha in Hebrew for in the format of שקלים, * זכור, פרה or החדש or an empty * string if there are none. 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 of Shekalim, * Zachor, Parah or Hachodesh. An empty string if there are none. */ formatSpecialParsha(jewishCalendar: JewishCalendar): string; }