@hebcal/core 6.5.0 → 6.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/dist/bundle.js +5983 -5473
  2. package/dist/bundle.js.map +1 -1
  3. package/dist/bundle.min.js +17 -17
  4. package/dist/bundle.min.js.map +1 -1
  5. package/dist/esm/CalOptions.d.ts +7 -4
  6. package/dist/esm/DailyLearning.d.ts +44 -7
  7. package/dist/esm/DailyLearning.js +45 -8
  8. package/dist/esm/DailyLearning.js.map +1 -1
  9. package/dist/esm/HebrewDateEvent.js +1 -1
  10. package/dist/esm/HolidayEvent.d.ts +34 -1
  11. package/dist/esm/HolidayEvent.js +35 -2
  12. package/dist/esm/HolidayEvent.js.map +1 -1
  13. package/dist/esm/MevarchimChodeshEvent.js +1 -1
  14. package/dist/esm/ParshaEvent.js +1 -1
  15. package/dist/esm/TimedEvent.d.ts +32 -3
  16. package/dist/esm/TimedEvent.js +33 -4
  17. package/dist/esm/TimedEvent.js.map +1 -1
  18. package/dist/esm/YomKippurKatanEvent.js +1 -1
  19. package/dist/esm/ashkenazi.po.d.ts +1 -0
  20. package/dist/esm/ashkenazi.po.js +2 -2
  21. package/dist/esm/ashkenazi.po.js.map +1 -1
  22. package/dist/esm/calendar.d.ts +1 -0
  23. package/dist/esm/calendar.js +12 -2
  24. package/dist/esm/calendar.js.map +1 -1
  25. package/dist/esm/candles.d.ts +14 -1
  26. package/dist/esm/candles.js +15 -2
  27. package/dist/esm/candles.js.map +1 -1
  28. package/dist/esm/cities.json.js +5 -0
  29. package/dist/esm/cities.json.js.map +1 -0
  30. package/dist/esm/event.d.ts +58 -13
  31. package/dist/esm/event.js +59 -14
  32. package/dist/esm/event.js.map +1 -1
  33. package/dist/esm/getStartAndEnd.js +10 -2
  34. package/dist/esm/getStartAndEnd.js.map +1 -1
  35. package/dist/esm/hallel.js +20 -28
  36. package/dist/esm/hallel.js.map +1 -1
  37. package/dist/esm/he-x-NoNikud.po.js +1 -1
  38. package/dist/esm/he.po.d.ts +1 -0
  39. package/dist/esm/he.po.js +2 -2
  40. package/dist/esm/he.po.js.map +1 -1
  41. package/dist/esm/hebcal.d.ts +97 -19
  42. package/dist/esm/hebcal.js +102 -21
  43. package/dist/esm/hebcal.js.map +1 -1
  44. package/dist/esm/holidays.d.ts +21 -2
  45. package/dist/esm/holidays.js +39 -3
  46. package/dist/esm/holidays.js.map +1 -1
  47. package/dist/esm/index.d.ts +1 -1
  48. package/dist/esm/index.js +2 -1
  49. package/dist/esm/index.js.map +1 -1
  50. package/dist/esm/isAssurBemlacha.d.ts +24 -4
  51. package/dist/esm/isAssurBemlacha.js +25 -5
  52. package/dist/esm/isAssurBemlacha.js.map +1 -1
  53. package/dist/esm/isAveilut.d.ts +14 -3
  54. package/dist/esm/isAveilut.js +15 -4
  55. package/dist/esm/isAveilut.js.map +1 -1
  56. package/dist/esm/isFastDay.d.ts +13 -1
  57. package/dist/esm/isFastDay.js +14 -2
  58. package/dist/esm/isFastDay.js.map +1 -1
  59. package/dist/esm/locale.js +1 -1
  60. package/dist/esm/location.d.ts +96 -8
  61. package/dist/esm/location.js +112 -88
  62. package/dist/esm/location.js.map +1 -1
  63. package/dist/esm/modern.js +1 -1
  64. package/dist/esm/molad.d.ts +39 -7
  65. package/dist/esm/molad.js +40 -8
  66. package/dist/esm/molad.js.map +1 -1
  67. package/dist/esm/moladBase.js +1 -1
  68. package/dist/esm/moladDate.js +1 -1
  69. package/dist/esm/omer.d.ts +32 -4
  70. package/dist/esm/omer.js +33 -5
  71. package/dist/esm/omer.js.map +1 -1
  72. package/dist/esm/parshaName.js +1 -1
  73. package/dist/esm/parshaYear.d.ts +12 -1
  74. package/dist/esm/parshaYear.js +13 -2
  75. package/dist/esm/parshaYear.js.map +1 -1
  76. package/dist/esm/pkgVersion.d.ts +1 -1
  77. package/dist/esm/pkgVersion.js +2 -2
  78. package/dist/esm/pkgVersion.js.map +1 -1
  79. package/dist/esm/reformatTimeStr.js +1 -1
  80. package/dist/esm/sedra.d.ts +94 -14
  81. package/dist/esm/sedra.js +95 -15
  82. package/dist/esm/sedra.js.map +1 -1
  83. package/dist/esm/sefira.json.js +1 -1
  84. package/dist/esm/staticHolidays.d.ts +2 -0
  85. package/dist/esm/staticHolidays.js +3 -1
  86. package/dist/esm/staticHolidays.js.map +1 -1
  87. package/dist/esm/tachanun.js +1 -1
  88. package/dist/esm/temporal-shim.js +1 -1
  89. package/dist/esm/zmanim.js +1 -1
  90. package/dist/src/CalOptions.d.ts +7 -4
  91. package/dist/src/DailyLearning.d.ts +44 -7
  92. package/dist/src/DailyLearning.js +44 -7
  93. package/dist/src/HolidayEvent.d.ts +34 -1
  94. package/dist/src/HolidayEvent.js +34 -1
  95. package/dist/src/TimedEvent.d.ts +32 -3
  96. package/dist/src/TimedEvent.js +32 -3
  97. package/dist/src/ashkenazi.po.d.ts +1 -0
  98. package/dist/src/ashkenazi.po.js +1 -1
  99. package/dist/src/calendar.d.ts +1 -0
  100. package/dist/src/calendar.js +11 -1
  101. package/dist/src/candles.d.ts +14 -1
  102. package/dist/src/candles.js +14 -1
  103. package/dist/src/cities.json +67 -0
  104. package/dist/src/event.d.ts +58 -13
  105. package/dist/src/event.js +58 -13
  106. package/dist/src/getStartAndEnd.js +9 -1
  107. package/dist/src/hallel.js +19 -27
  108. package/dist/src/he.po.d.ts +1 -0
  109. package/dist/src/he.po.js +1 -1
  110. package/dist/src/hebcal.d.ts +97 -19
  111. package/dist/src/hebcal.js +101 -20
  112. package/dist/src/holidays.d.ts +21 -2
  113. package/dist/src/holidays.js +38 -2
  114. package/dist/src/index.d.ts +1 -1
  115. package/dist/src/index.js +1 -0
  116. package/dist/src/isAssurBemlacha.d.ts +24 -4
  117. package/dist/src/isAssurBemlacha.js +24 -4
  118. package/dist/src/isAveilut.d.ts +14 -3
  119. package/dist/src/isAveilut.js +14 -3
  120. package/dist/src/isFastDay.d.ts +13 -1
  121. package/dist/src/isFastDay.js +13 -1
  122. package/dist/src/location.d.ts +96 -8
  123. package/dist/src/location.js +111 -87
  124. package/dist/src/molad.d.ts +39 -7
  125. package/dist/src/molad.js +39 -7
  126. package/dist/src/omer.d.ts +32 -4
  127. package/dist/src/omer.js +32 -4
  128. package/dist/src/parshaYear.d.ts +12 -1
  129. package/dist/src/parshaYear.js +12 -1
  130. package/dist/src/pkgVersion.d.ts +1 -1
  131. package/dist/src/pkgVersion.js +1 -1
  132. package/dist/src/sedra.d.ts +94 -14
  133. package/dist/src/sedra.js +94 -14
  134. package/dist/src/staticHolidays.d.ts +2 -0
  135. package/dist/src/staticHolidays.js +2 -0
  136. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"molad.js","sources":["../../../src/molad.ts"],"sourcesContent":["import './temporal-shim';\nimport {Event, flags} from './event';\nimport {CalOptions} from './CalOptions';\nimport {HDate, Locale, pad2} from '@hebcal/hdate';\nimport {reformatTimeStr} from './reformatTimeStr';\nimport {MoladBase, calculateMolad} from './moladBase';\nimport {getMoladAsDate} from './moladDate';\nimport './locale'; // Adds Hebrew and Ashkenazic translations\n\nconst enDoW = [\n 'Sunday',\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday',\n 'Saturday',\n] as const;\n\nconst heDayNames = [\n 'רִאשׁוֹן',\n 'שֵׁנִי',\n 'שְׁלִישִׁי',\n 'רְבִיעִי',\n 'חֲמִישִׁי',\n 'שִׁישִּׁי',\n 'שַׁבָּת',\n] as const;\n\nconst frDoW = [\n 'Dimanche',\n 'Lundi',\n 'Mardi',\n 'Mercredi',\n 'Jeudi',\n 'Vendredi',\n 'Samedi',\n] as const;\nconst night = 'בַּלַּ֥יְלָה';\n\nfunction getDayNames(locale?: string): readonly string[] {\n if (Locale.isHebrewLocale(locale)) {\n return heDayNames;\n } else if (locale === 'fr') {\n return frDoW;\n }\n return enDoW;\n}\n\nfunction getHebrewTimeOfDay(hour: number): string {\n if (hour < 5) return night;\n else if (hour < 12) return 'בַּבֹּקֶר';\n else if (hour < 17) return 'בַּצׇּהֳרַיִים';\n else if (hour < 21) return 'בָּעֶרֶב';\n return night;\n}\n\n/**\n * Represents a molad, the moment when the new moon is \"born\"\n */\nexport class Molad {\n private readonly m: MoladBase;\n private readonly year: number;\n private readonly month: number;\n private instant?: Temporal.ZonedDateTime;\n\n /**\n * Calculates the molad for a Hebrew month\n * @param year\n * @param month 1=NISSAN, 7=TISHREI\n */\n constructor(year: number, month: number) {\n this.m = calculateMolad(year, month);\n this.year = year;\n this.month = month;\n }\n /**\n * The exact Hebrew date of the molad, which often falls on the\n * 28th or 30th of the preceeding month, occasionally on the first of the\n * month, and in extremely rare circumstances the 27th of the month.\n * - Molad Shevat 5541 occured on 27 Tevet / 1781-01-24T19:57:20.170Z\n * - Molad Shevat 5788 will occur on 27 Tevet / 2028-01-26T19:07:03.504Z\n * - Molad Nissan 5866 will occur on 27 Adar II / 2106-04-03T21:08:46.837Z\n */\n getMoladDate(): HDate {\n return this.m.hdate;\n }\n /**\n * The year of the molad (as constructed)\n */\n getYear(): number {\n return this.year;\n }\n /**\n * The month (1=NISSAN, 7=TISHREI) as constructed\n */\n getMonth(): number {\n return this.month;\n }\n /**\n * Returns a transliterated string name of the molad's Hebrew month,\n * for example 'Elul' or 'Cheshvan'.\n */\n getMonthName(): string {\n return HDate.getMonthName(this.month, this.year);\n }\n /**\n * @returns Day of Week (0=Sunday, 6=Saturday)\n */\n getDow(): number {\n return this.m.hdate.getDay();\n }\n /**\n * @returns hour of day (0-23)\n */\n getHour(): number {\n return this.m.hour;\n }\n /**\n * @returns minutes past hour (0-59)\n */\n getMinutes(): number {\n return this.m.minutes;\n }\n /**\n * @returns parts of a minute (0-17)\n */\n getChalakim(): number {\n return this.m.chalakim;\n }\n /**\n * Returns the molad in Standard Time in Yerushalayim as a Temporal.ZonedDateTime.\n * This method subtracts 20.94 minutes (20 minutes and 56.496 seconds) from the computed time (Har Habayis with a longitude\n * of 35.2354&deg; is 5.2354&deg; away from the %15 timezone longitude) to get to standard time. This method\n * intentionally uses standard time and not daylight savings time.\n *\n * @return the Temporal.ZonedDateTime representing the moment of the molad in Yerushalayim standard time (GMT + 2)\n */\n getInstant(): Temporal.ZonedDateTime {\n this.instant ??= getMoladAsDate(this.m);\n return this.instant;\n }\n /**\n * Returns the earliest time of _Kiddush Levana_ calculated as 3 days after the molad. This method returns the time\n * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider\n * displaying the next _tzais_ if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment 3 days after the molad.\n */\n getTchilasZmanKidushLevana3Days(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n return zdt.add({hours: 72});\n }\n\n /**\n * Returns the earliest time of Kiddush Levana calculated as 7 days after the molad as mentioned by the <a\n * href=\"https://en.wikipedia.org/wiki/Yosef_Karo\">Mechaber</a>. See the <a\n * href=\"https://en.wikipedia.org/wiki/Yoel_Sirkis\">Bach's</a> opinion on this time. This method returns the time\n * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider\n * displaying the next _tzais_ if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment 7 days after the molad.\n */\n getTchilasZmanKidushLevana7Days(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n return zdt.add({hours: 168});\n }\n\n /**\n * Returns the latest time of Kiddush Levana according to the <a\n * href=\"https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin\">Maharil's</a> opinion that it is calculated as\n * halfway between molad and molad. This adds half the 29 days, 12 hours and 793 chalakim time between molad and\n * molad (14 days, 18 hours, 22 minutes and 666 milliseconds) to the month's molad. This method returns the time\n * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider\n * displaying _alos_ before this time if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment halfway between molad and molad.\n */\n getSofZmanKidushLevanaBetweenMoldos(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n // add half the time between molad and molad (half of 29 days, 12 hours and 793 chalakim (44 minutes, 3.3\n // seconds), or 14 days, 18 hours, 22 minutes and 666 milliseconds). Add it as hours, not days, to avoid\n // DST/ST crossover issues.\n return zdt.add({\n hours: 24 * 14 + 18,\n minutes: 22,\n seconds: 1,\n milliseconds: 666,\n });\n }\n\n /**\n * Returns the latest time of Kiddush Levana calculated as 15 days after the molad. This is the opinion brought down\n * in the Shulchan Aruch (Orach Chaim 426). It should be noted that some opinions hold that the\n * <a href=\"https://en.wikipedia.org/wiki/Moses_Isserles\">Rema</a> who brings down the opinion of the <a\n * href=\"https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin\">Maharil's</a> of calculating\n * {@link Molad.getSofZmanKidushLevanaBetweenMoldos() half way between molad and mold} is of the opinion that Mechaber\n * agrees to his opinion. Also see the Aruch Hashulchan. For additional details on the subject, See Rabbi Dovid\n * Heber's very detailed writeup in Siman Daled (chapter 4) of <a\n * href=\"https://www.worldcat.org/oclc/461326125\">Shaarei Zmanim</a>. This method returns the time even if it is during\n * the day when _Kiddush Levana_ can't be said. Callers of this method should consider displaying _alos_\n * before this time if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment 15 days after the molad.\n */\n getSofZmanKidushLevana15Days(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n // 15 days after the molad. Add it as hours, not days, to avoid DST/ST crossover issues.\n return zdt.add({hours: 24 * 15});\n }\n\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n * @param options\n */\n render(locale?: string, options?: CalOptions): string {\n const monthName = Locale.gettext(this.getMonthName(), locale);\n const dayNames = getDayNames(locale);\n const dow = dayNames[this.getDow()];\n const minutes = this.getMinutes();\n const hour = this.getHour();\n const chalakim = this.getChalakim();\n const moladStr = Locale.gettext('Molad', locale);\n const minutesStr = Locale.lookupTranslation('min', locale) ?? 'minutes';\n const chalakimStr = Locale.gettext('chalakim', locale);\n const and = Locale.gettext('and', locale);\n if (Locale.isHebrewLocale(locale)) {\n const ampm = getHebrewTimeOfDay(hour);\n let result =\n `${moladStr} ${monthName} יִהְיֶה בַּיּוֹם ${dow} בשָׁבוּעַ, ` +\n `בְּשָׁעָה ${hour} ${ampm}, ` +\n `ו-${minutes} ${minutesStr}`;\n if (chalakim !== 0) {\n result += ` ו-${chalakim} ${chalakimStr}`;\n }\n if (locale!.toLocaleLowerCase() === 'he-x-nonikud') {\n return Locale.hebrewStripNikkud(result);\n }\n return result;\n }\n const fmtTime = reformatTimeStr(`${hour}:${pad2(minutes)}`, 'pm', options);\n const month = monthName.replace(/'/g, '’');\n const result = `${moladStr} ${month}: ${dow}, ${fmtTime}`;\n if (chalakim === 0) {\n return result;\n }\n return result + ` ${and} ${chalakim} ${chalakimStr}`;\n }\n}\n\n/** Represents a Molad announcement on Shabbat Mevarchim */\nexport class MoladEvent extends Event {\n readonly molad: Molad;\n private readonly options: CalOptions;\n /**\n * @param date Hebrew date event occurs\n * @param hyear molad year\n * @param hmonth molad month\n * @param options\n */\n constructor(date: HDate, hyear: number, hmonth: number, options: CalOptions) {\n const m = new Molad(hyear, hmonth);\n const monthName = m.getMonthName();\n super(date, `Molad ${monthName} ${hyear}`, flags.MOLAD);\n this.molad = m;\n this.options = options;\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n render(locale?: string): string {\n return this.molad.render(locale, this.options);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;AASA,MAAM,KAAK,GAAG;IACZ,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,WAAW;IACX,UAAU;IACV,QAAQ;IACR,UAAU;CACF;AAEV,MAAM,UAAU,GAAG;IACjB,UAAU;IACV,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,WAAW;IACX,WAAW;IACX,SAAS;CACD;AAEV,MAAM,KAAK,GAAG;IACZ,UAAU;IACV,OAAO;IACP,OAAO;IACP,UAAU;IACV,OAAO;IACP,UAAU;IACV,QAAQ;CACA;AACV,MA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AG,OAAO;IACxB;AACA;;AAEG;AACH,IAAA,MAAM,CAAC,MAAe,EAAA;AACpB,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC;IAChD;AACD;;;;"}
1
+ {"version":3,"file":"molad.js","sources":["../../../src/molad.ts"],"sourcesContent":["import './temporal-shim';\nimport {Event, flags} from './event';\nimport {CalOptions} from './CalOptions';\nimport {HDate, Locale, pad2} from '@hebcal/hdate';\nimport {reformatTimeStr} from './reformatTimeStr';\nimport {MoladBase, calculateMolad} from './moladBase';\nimport {getMoladAsDate} from './moladDate';\nimport './locale'; // Adds Hebrew and Ashkenazic translations\n\nconst enDoW = [\n 'Sunday',\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday',\n 'Saturday',\n] as const;\n\nconst heDayNames = [\n 'רִאשׁוֹן',\n 'שֵׁנִי',\n 'שְׁלִישִׁי',\n 'רְבִיעִי',\n 'חֲמִישִׁי',\n 'שִׁישִּׁי',\n 'שַׁבָּת',\n] as const;\n\nconst frDoW = [\n 'Dimanche',\n 'Lundi',\n 'Mardi',\n 'Mercredi',\n 'Jeudi',\n 'Vendredi',\n 'Samedi',\n] as const;\nconst night = 'בַּלַּ֥יְלָה';\n\nfunction getDayNames(locale?: string): readonly string[] {\n if (Locale.isHebrewLocale(locale)) {\n return heDayNames;\n } else if (locale === 'fr') {\n return frDoW;\n }\n return enDoW;\n}\n\nfunction getHebrewTimeOfDay(hour: number): string {\n if (hour < 5) return night;\n else if (hour < 12) return 'בַּבֹּקֶר';\n else if (hour < 17) return 'בַּצׇּהֳרַיִים';\n else if (hour < 21) return 'בָּעֶרֶב';\n return night;\n}\n\n/**\n * Represents a *molad* — the calculated moment when the new moon is \"born\"\n * for a given Hebrew month.\n *\n * The molad is announced in synagogue on Shabbat Mevarchim (the Shabbat\n * before Rosh Chodesh) and is the anchor point for Kiddush Levana zmanim.\n * Calculations use the traditional chalakim arithmetic\n * (1 hour = 1080 chalakim) anchored to *Molad Tohu BaHaRaD*.\n *\n * @example\n * import {Molad, months} from '@hebcal/core';\n * const m = new Molad(5784, months.NISAN);\n * console.log(m.getMonthName()); // 'Nisan'\n * console.log(m.getHour(), m.getMinutes(), m.getChalakim()); // e.g. 1 31 12\n * console.log(m.render('en')); // 'Molad Nisan: Mon, 1:31am and 12 chalakim'\n */\nexport class Molad {\n private readonly m: MoladBase;\n private readonly year: number;\n private readonly month: number;\n private instant?: Temporal.ZonedDateTime;\n\n /**\n * Calculates the molad for a given Hebrew year and month.\n * @param year Hebrew year\n * @param month 1=NISAN, 7=TISHREI (uses Nisan-based numbering)\n */\n constructor(year: number, month: number) {\n this.m = calculateMolad(year, month);\n this.year = year;\n this.month = month;\n }\n /**\n * The exact Hebrew date of the molad, which often falls on the\n * 28th or 30th of the preceeding month, occasionally on the first of the\n * month, and in extremely rare circumstances the 27th of the month.\n * - Molad Shevat 5541 occured on 27 Tevet / 1781-01-24T19:57:20.170Z\n * - Molad Shevat 5788 will occur on 27 Tevet / 2028-01-26T19:07:03.504Z\n * - Molad Nissan 5866 will occur on 27 Adar II / 2106-04-03T21:08:46.837Z\n */\n getMoladDate(): HDate {\n return this.m.hdate;\n }\n /**\n * The year of the molad (as constructed)\n */\n getYear(): number {\n return this.year;\n }\n /**\n * The month (1=NISSAN, 7=TISHREI) as constructed\n */\n getMonth(): number {\n return this.month;\n }\n /**\n * Returns a transliterated string name of the molad's Hebrew month,\n * for example 'Elul' or 'Cheshvan'.\n */\n getMonthName(): string {\n return HDate.getMonthName(this.month, this.year);\n }\n /**\n * @returns Day of Week (0=Sunday, 6=Saturday)\n */\n getDow(): number {\n return this.m.hdate.getDay();\n }\n /**\n * @returns hour of day (0-23)\n */\n getHour(): number {\n return this.m.hour;\n }\n /**\n * @returns minutes past hour (0-59)\n */\n getMinutes(): number {\n return this.m.minutes;\n }\n /**\n * @returns parts of a minute (0-17)\n */\n getChalakim(): number {\n return this.m.chalakim;\n }\n /**\n * Returns the molad in Standard Time in Yerushalayim as a `Temporal.ZonedDateTime`.\n * This method subtracts 20.94 minutes (20 minutes and 56.496 seconds) from the computed time (Har Habayis with a longitude\n * of 35.2354&deg; is 5.2354&deg; away from the %15 timezone longitude) to get to standard time. This method\n * intentionally uses standard time and not daylight savings time.\n *\n * The returned value is cached after the first call.\n * @example\n * import {Molad, months} from '@hebcal/core';\n * const m = new Molad(5784, months.NISAN);\n * const zdt = m.getInstant();\n * console.log(zdt.toString()); // e.g. '2024-04-08T17:21:13.333+00:00[UTC]'\n * @return the `Temporal.ZonedDateTime` representing the moment of the molad\n */\n getInstant(): Temporal.ZonedDateTime {\n this.instant ??= getMoladAsDate(this.m);\n return this.instant;\n }\n /**\n * Returns the earliest time of _Kiddush Levana_ calculated as 3 days after the molad. This method returns the time\n * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider\n * displaying the next _tzais_ if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment 3 days after the molad.\n */\n getTchilasZmanKidushLevana3Days(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n return zdt.add({hours: 72});\n }\n\n /**\n * Returns the earliest time of Kiddush Levana calculated as 7 days after the molad as mentioned by the <a\n * href=\"https://en.wikipedia.org/wiki/Yosef_Karo\">Mechaber</a>. See the <a\n * href=\"https://en.wikipedia.org/wiki/Yoel_Sirkis\">Bach's</a> opinion on this time. This method returns the time\n * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider\n * displaying the next _tzais_ if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment 7 days after the molad.\n */\n getTchilasZmanKidushLevana7Days(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n return zdt.add({hours: 168});\n }\n\n /**\n * Returns the latest time of Kiddush Levana according to the <a\n * href=\"https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin\">Maharil's</a> opinion that it is calculated as\n * halfway between molad and molad. This adds half the 29 days, 12 hours and 793 chalakim time between molad and\n * molad (14 days, 18 hours, 22 minutes and 666 milliseconds) to the month's molad. This method returns the time\n * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider\n * displaying _alos_ before this time if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment halfway between molad and molad.\n */\n getSofZmanKidushLevanaBetweenMoldos(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n // add half the time between molad and molad (half of 29 days, 12 hours and 793 chalakim (44 minutes, 3.3\n // seconds), or 14 days, 18 hours, 22 minutes and 666 milliseconds). Add it as hours, not days, to avoid\n // DST/ST crossover issues.\n return zdt.add({\n hours: 24 * 14 + 18,\n minutes: 22,\n seconds: 1,\n milliseconds: 666,\n });\n }\n\n /**\n * Returns the latest time of Kiddush Levana calculated as 15 days after the molad. This is the opinion brought down\n * in the Shulchan Aruch (Orach Chaim 426). It should be noted that some opinions hold that the\n * <a href=\"https://en.wikipedia.org/wiki/Moses_Isserles\">Rema</a> who brings down the opinion of the <a\n * href=\"https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin\">Maharil's</a> of calculating\n * {@link Molad.getSofZmanKidushLevanaBetweenMoldos() half way between molad and mold} is of the opinion that Mechaber\n * agrees to his opinion. Also see the Aruch Hashulchan. For additional details on the subject, See Rabbi Dovid\n * Heber's very detailed writeup in Siman Daled (chapter 4) of <a\n * href=\"https://www.worldcat.org/oclc/461326125\">Shaarei Zmanim</a>. This method returns the time even if it is during\n * the day when _Kiddush Levana_ can't be said. Callers of this method should consider displaying _alos_\n * before this time if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment 15 days after the molad.\n */\n getSofZmanKidushLevana15Days(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n // 15 days after the molad. Add it as hours, not days, to avoid DST/ST crossover issues.\n return zdt.add({hours: 24 * 15});\n }\n\n /**\n * Returns a human-readable, localized string announcing the molad —\n * suitable for use on Shabbat Mevarchim. The format includes the Hebrew\n * month name, day of week, hour : minute, and chalakim if non-zero.\n *\n * Time format honors `options.hour12` and `options.location` (12-hour vs.\n * 24-hour); see {@link HebrewCalendar.reformatTimeStr}.\n * @example\n * import {Molad, months} from '@hebcal/core';\n * const m = new Molad(5784, months.NISAN);\n * m.render('en', {hour12: true});\n * // => 'Molad Nisan: Mon, 7:21pm and 6 chalakim'\n * m.render('he');\n * // => 'מוֹלָד נִיסָן יִהְיֶה בַּיּוֹם שֵׁנִי בשָׁבוּעַ, …'\n * @param [locale] Optional locale name (defaults to empty locale)\n * @param options used for time formatting (12-hour vs 24-hour)\n */\n render(locale?: string, options?: CalOptions): string {\n const monthName = Locale.gettext(this.getMonthName(), locale);\n const dayNames = getDayNames(locale);\n const dow = dayNames[this.getDow()];\n const minutes = this.getMinutes();\n const hour = this.getHour();\n const chalakim = this.getChalakim();\n const moladStr = Locale.gettext('Molad', locale);\n const minutesStr = Locale.lookupTranslation('min', locale) ?? 'minutes';\n const chalakimStr = Locale.gettext('chalakim', locale);\n const and = Locale.gettext('and', locale);\n if (Locale.isHebrewLocale(locale)) {\n const ampm = getHebrewTimeOfDay(hour);\n let result =\n `${moladStr} ${monthName} יִהְיֶה בַּיּוֹם ${dow} בשָׁבוּעַ, ` +\n `בְּשָׁעָה ${hour} ${ampm}, ` +\n `ו-${minutes} ${minutesStr}`;\n if (chalakim !== 0) {\n result += ` ו-${chalakim} ${chalakimStr}`;\n }\n if (locale!.toLocaleLowerCase() === 'he-x-nonikud') {\n return Locale.hebrewStripNikkud(result);\n }\n return result;\n }\n const fmtTime = reformatTimeStr(`${hour}:${pad2(minutes)}`, 'pm', options);\n const month = monthName.replace(/'/g, '’');\n const result = `${moladStr} ${month}: ${dow}, ${fmtTime}`;\n if (chalakim === 0) {\n return result;\n }\n return result + ` ${and} ${chalakim} ${chalakimStr}`;\n }\n}\n\n/** Represents a Molad announcement on Shabbat Mevarchim */\nexport class MoladEvent extends Event {\n readonly molad: Molad;\n private readonly options: CalOptions;\n /**\n * @param date Hebrew date event occurs\n * @param hyear molad year\n * @param hmonth molad month\n * @param options\n */\n constructor(date: HDate, hyear: number, hmonth: number, options: CalOptions) {\n const m = new Molad(hyear, hmonth);\n const monthName = m.getMonthName();\n super(date, `Molad ${monthName} ${hyear}`, flags.MOLAD);\n this.molad = m;\n this.options = options;\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n render(locale?: string): string {\n return this.molad.render(locale, this.options);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;AASA,MAAM,KAAK,GAAG;IACZ,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,WAAW;IACX,UAAU;IACV,QAAQ;IACR,UAAU;CACF;AAEV,MAAM,UAAU,GAAG;IACjB,UAAU;IACV,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,WAAW;IACX,WAAW;IACX,SAAS;CACD;AAEV,MAAM,KAAK,GAAG;IACZ,UAAU;IACV,OAAO;IACP,OAAO;IACP,UAAU;IACV,OAAO;IACP,UAAU;IACV,QAAQ;CACA;AACV,MAAM,KAAK,GAAG,cAAc;AAE5B,SAAS,WAAW,CAAC,MAAe,EAAA;AAClC,IAAA,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE;AACjC,QAAA,OAAO,UAAU;IACnB;AAAO,SAAA,IAAI,MAAM,KAAK,IAAI,EAAE;AAC1B,QAAA,OAAO,KAAK;IACd;AACA,IAAA,OAAO,KAAK;AACd;AAEA,SAAS,kBAAkB,CAAC,IAAY,EAAA;IACtC,IAAI,IAAI,GAAG,CAAC;AAAE,QAAA,OAAO,KAAK;SACrB,IAAI,IAAI,GAAG,EAAE;AAAE,QAAA,OAAO,WAAW;SACjC,IAAI,IAAI,GAAG,EAAE;AAAE,QAAA,OAAO,gBAAgB;SACtC,IAAI,IAAI,GAAG,EAAE;AAAE,QAAA,OAAO,UAAU;AACrC,IAAA,OAAO,KAAK;AACd;AAEA;;;;;;;;;;;;;;;AA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AK,GAAG,CAAA,EAAA,EAAK,OAAO,CAAA,CAAE;AACzD,QAAA,IAAI,QAAQ,KAAK,CAAC,EAAE;AAClB,YAAA,OAAO,MAAM;QACf;QACA,OAAO,MAAM,GAAG,CAAA,CAAA,EAAI,GAAG,IAAI,QAAQ,CAAA,CAAA,EAAI,WAAW,CAAA,CAAE;IACtD;AACD;AAED;AACM,MAAO,UAAW,SAAQ,KAAK,CAAA;AAC1B,IAAA,KAAK;AACG,IAAA,OAAO;AACxB;;;;;AAKG;AACH,IAAA,WAAA,CAAY,IAAW,EAAE,KAAa,EAAE,MAAc,EAAE,OAAmB,EAAA;QACzE,MAAM,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC;AAClC,QAAA,MAAM,SAAS,GAAG,CAAC,CAAC,YAAY,EAAE;AAClC,QAAA,KAAK,CAAC,IAAI,EAAE,CAAA,MAAA,EAAS,SAAS,CAAA,CAAA,EAAI,KAAK,CAAA,CAAE,EAAE,KAAK,CAAC,KAAK,CAAC;AACvD,QAAA,IAAI,CAAC,KAAK,GAAG,CAAC;AACd,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO;IACxB;AACA;;AAEG;AACH,IAAA,MAAM,CAAC,MAAe,EAAA;AACpB,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC;IAChD;AACD;;;;"}
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.5.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.5.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { HDate, isLeapYear } from '@hebcal/hdate';
3
3
 
4
4
  /*
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.5.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.5.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import './temporal-shim.js';
3
3
  import { getTimezoneOffset } from '@hebcal/hdate';
4
4
 
@@ -6,21 +6,49 @@ import './locale';
6
6
  * Lang for the Sefira can be English, Hebrew, or Hebrew in Sephardic transliteration.
7
7
  */
8
8
  export type OmerLang = 'en' | 'he' | 'translit';
9
- /** Represents a day 1-49 of counting the Omer from Pesach to Shavuot */
9
+ /**
10
+ * Represents one of the 49 days of counting the Omer between Pesach and
11
+ * Shavuot (16 Nisan through 5 Sivan).
12
+ *
13
+ * Each day has an associated Sefirah pairing (e.g. *Chesed shebiGevurah*),
14
+ * a word from Psalm 67 (Lamnatzeach), a letter from verse 5 of Psalm 67,
15
+ * and a word/acrostic from the Ana BeKoach prayer — all accessible via
16
+ * the methods on this class.
17
+ *
18
+ * @example
19
+ * import {OmerEvent, HDate, months} from '@hebcal/core';
20
+ * const ev = new OmerEvent(new HDate(16, months.NISAN, 5784), 1);
21
+ * ev.render('en'); // '1st day of the Omer'
22
+ * ev.render('he'); // 'א׳ בָּעוֹמֶר'
23
+ * ev.sefira('translit'); // 'Chesed shebChesed'
24
+ * ev.getTodayIs('en'); // 'Today is 1 day of the Omer'
25
+ */
10
26
  export declare class OmerEvent extends Event {
11
27
  private readonly weekNumber;
12
28
  private readonly daysWithinWeeks;
13
29
  readonly omer: number;
14
30
  /**
15
- * @param date
16
- * @param omerDay
31
+ * Constructs an Omer event for a given day (1–49).
32
+ *
33
+ * Throws `RangeError` if `omerDay` is outside 1–49.
34
+ * @param date Hebrew date this Omer day is counted on (the evening of)
35
+ * @param omerDay day of the Omer, 1 through 49
17
36
  */
18
37
  constructor(date: HDate, omerDay: number);
19
38
  /**
20
- * Returns the sefira. For example, on day 8:
39
+ * Returns the Sefirah pairing associated with this Omer day
40
+ * one of the seven lower Sefirot within another, calculated as
41
+ * `day-within-week` of `week-within-cycle`. For example, on day 8
42
+ * (week 2, day 1):
21
43
  * * חֶֽסֶד שֶׁבִּגְבוּרָה
22
44
  * * Chesed shebiGevurah
23
45
  * * Lovingkindness within Might
46
+ * @example
47
+ * import {OmerEvent, HDate, months} from '@hebcal/core';
48
+ * const day8 = new OmerEvent(new HDate(23, months.NISAN, 5784), 8);
49
+ * day8.sefira('en'); // 'Lovingkindness within Might'
50
+ * day8.sefira('he'); // 'חֶֽסֶד שֶׁבִּגְבוּרָה'
51
+ * day8.sefira('translit'); // 'Chesed shebiGevurah'
24
52
  * @param lang `en` (English), `he` (Hebrew with nikud), or `translit` (Hebrew in Sephardic transliteration)
25
53
  * @returns a string such as `Lovingkindness within Might` or `חֶֽסֶד שֶׁבִּגְבוּרָה`
26
54
  */
package/dist/esm/omer.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.5.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.5.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { Locale, gematriya } from '@hebcal/hdate';
3
3
  import { Event, flags } from './event.js';
4
4
  import './locale.js';
@@ -190,14 +190,33 @@ const anaBekoach = sefira.anaBekoach;
190
190
  const ps67lines = sefira.ps67lines;
191
191
  const lamnatzeach = ps67lines.flatMap((x) => x.split(/[ ־]/));
192
192
  const lamnatzeachLetters = sefira.lamnatzeachLetters.split('');
193
- /** Represents a day 1-49 of counting the Omer from Pesach to Shavuot */
193
+ /**
194
+ * Represents one of the 49 days of counting the Omer between Pesach and
195
+ * Shavuot (16 Nisan through 5 Sivan).
196
+ *
197
+ * Each day has an associated Sefirah pairing (e.g. *Chesed shebiGevurah*),
198
+ * a word from Psalm 67 (Lamnatzeach), a letter from verse 5 of Psalm 67,
199
+ * and a word/acrostic from the Ana BeKoach prayer — all accessible via
200
+ * the methods on this class.
201
+ *
202
+ * @example
203
+ * import {OmerEvent, HDate, months} from '@hebcal/core';
204
+ * const ev = new OmerEvent(new HDate(16, months.NISAN, 5784), 1);
205
+ * ev.render('en'); // '1st day of the Omer'
206
+ * ev.render('he'); // 'א׳ בָּעוֹמֶר'
207
+ * ev.sefira('translit'); // 'Chesed shebChesed'
208
+ * ev.getTodayIs('en'); // 'Today is 1 day of the Omer'
209
+ */
194
210
  class OmerEvent extends Event {
195
211
  weekNumber;
196
212
  daysWithinWeeks;
197
213
  omer;
198
214
  /**
199
- * @param date
200
- * @param omerDay
215
+ * Constructs an Omer event for a given day (1–49).
216
+ *
217
+ * Throws `RangeError` if `omerDay` is outside 1–49.
218
+ * @param date Hebrew date this Omer day is counted on (the evening of)
219
+ * @param omerDay day of the Omer, 1 through 49
201
220
  */
202
221
  constructor(date, omerDay) {
203
222
  super(date, `Omer ${omerDay}`, flags.OMER_COUNT);
@@ -207,10 +226,19 @@ class OmerEvent extends Event {
207
226
  this.omer = omerDay;
208
227
  }
209
228
  /**
210
- * Returns the sefira. For example, on day 8:
229
+ * Returns the Sefirah pairing associated with this Omer day
230
+ * one of the seven lower Sefirot within another, calculated as
231
+ * `day-within-week` of `week-within-cycle`. For example, on day 8
232
+ * (week 2, day 1):
211
233
  * * חֶֽסֶד שֶׁבִּגְבוּרָה
212
234
  * * Chesed shebiGevurah
213
235
  * * Lovingkindness within Might
236
+ * @example
237
+ * import {OmerEvent, HDate, months} from '@hebcal/core';
238
+ * const day8 = new OmerEvent(new HDate(23, months.NISAN, 5784), 8);
239
+ * day8.sefira('en'); // 'Lovingkindness within Might'
240
+ * day8.sefira('he'); // 'חֶֽסֶד שֶׁבִּגְבוּרָה'
241
+ * day8.sefira('translit'); // 'Chesed shebiGevurah'
214
242
  * @param lang `en` (English), `he` (Hebrew with nikud), or `translit` (Hebrew in Sephardic transliteration)
215
243
  * @returns a string such as `Lovingkindness within Might` or `חֶֽסֶד שֶׁבִּגְבוּרָה`
216
244
  */
@@ -1 +1 @@
1
- {"version":3,"file":"omer.js","sources":["../../../src/omer.ts"],"sourcesContent":["import {HDate, Locale, gematriya} from '@hebcal/hdate';\nimport {Event, flags} from './event';\nimport './locale'; // Adds Hebrew and Ashkenazic translations\nimport sefira from './sefira.json';\n\n/**\n * Language for counting the Omer can be English or Hebrew.\n * Lang for the Sefira can be English, Hebrew, or Hebrew in Sephardic transliteration.\n */\nexport type OmerLang = 'en' | 'he' | 'translit';\n\nconst sefirot = {\n en: {\n infix: 'within ',\n infix26: 'within ',\n words: [\n '',\n 'Lovingkindness',\n 'Might',\n 'Beauty',\n 'Eternity',\n 'Splendor',\n 'Foundation',\n 'Majesty',\n ],\n pfxWords: null,\n },\n he: {\n infix: null,\n infix26: null,\n words: [\n '',\n 'חֶֽסֶד',\n 'גְּבוּרָה',\n 'תִּפְאֶֽרֶת',\n 'נֶּֽצַח',\n 'הוֹד',\n 'יְּסוֹד',\n 'מַלְכוּת',\n ],\n pfxWords: [\n '',\n 'שֶׁבְּחֶֽסֶד',\n 'שֶׁבִּגְבוּרָה',\n 'שֶׁבְּתִפְאֶֽרֶת',\n 'שֶׁבְּנֶֽצַח',\n 'שֶׁבְּהוֹד',\n 'שֶׁבִּיְסוֹד',\n 'שֶׁבְּמַלְכוּת',\n ],\n },\n translit: {\n infix: \"sheb'\",\n infix26: 'shebi',\n words: [\n '',\n 'Chesed',\n 'Gevurah',\n 'Tiferet',\n 'Netzach',\n 'Hod',\n 'Yesod',\n 'Malkhut',\n ],\n pfxWords: null,\n },\n} as const;\n\nfunction checkDay(omerDay: number): void {\n if (omerDay < 1 || omerDay > 49) {\n throw new RangeError(`Invalid Omer day ${omerDay}`);\n }\n}\n\nfunction getWeeks(omerDay: number): number[] {\n const weekNum: number = Math.floor((omerDay - 1) / 7) + 1;\n const daysWithinWeeks: number = omerDay % 7 || 7;\n return [weekNum, daysWithinWeeks];\n}\n\nfunction omerTodayIsEn(omerDay: number): string {\n const [weekNumber, daysWithinWeeks]: number[] = getWeeks(omerDay);\n\n const totalDaysStr: string = omerDay === 1 ? 'day' : 'days';\n let str = `Today is ${omerDay} ${totalDaysStr}`;\n\n if (weekNumber > 1 || omerDay === 7) {\n const day7: boolean = daysWithinWeeks === 7;\n const numWeeks: number = day7 ? weekNumber : weekNumber - 1;\n const weeksStr: string = numWeeks === 1 ? 'week' : 'weeks';\n str += `, which are ${numWeeks} ${weeksStr}`;\n if (!day7) {\n const daysStr: string = daysWithinWeeks === 1 ? 'day' : 'days';\n str += ` and ${daysWithinWeeks} ${daysStr}`;\n }\n }\n return str + ' of the Omer';\n}\n\n// adapted from pip hdate package (GPL)\n// https://github.com/py-libhdate/py-libhdate/blob/master/hdate/date.py\n\nconst tens = ['', 'עֲשָׂרָה', 'עֶשְׂרִים', 'שְׁלוֹשִׁים', 'אַרְבָּעִים'];\nconst ones = [\n '',\n 'אֶחָד',\n 'שְׁנַיִם',\n 'שְׁלוֹשָׁה',\n 'אַרְבָּעָה',\n 'חֲמִשָּׁה',\n 'שִׁשָּׁה',\n 'שִׁבְעָה',\n 'שְׁמוֹנָה',\n 'תִּשְׁעָה',\n];\n\nconst shnei = 'שְׁנֵי';\nconst yamim = 'יָמִים';\nconst shneiYamim = shnei + ' ' + yamim;\nconst shavuot = 'שָׁבוּעוֹת';\nconst yom = 'יוֹם';\nconst yomEchad = yom + ' ' + ones[1];\nconst asar = 'עָשָׂר';\n\nfunction omerTodayIsHe(omerDay: number): string {\n const ten: number = Math.floor(omerDay / 10);\n const one: number = omerDay % 10;\n let str = 'הַיּוֹם ';\n if (omerDay === 11) {\n str += 'אַחַד ' + asar;\n } else if (omerDay === 12) {\n str += 'שְׁנֵים ' + asar;\n } else if (12 < omerDay && omerDay < 20) {\n str += ones[one] + ' ' + asar;\n } else if (omerDay > 9) {\n str += ones[one];\n if (one) {\n str += ' ';\n str += ten === 3 ? 'וּ' : 'וְ';\n }\n }\n if (omerDay > 2) {\n if (omerDay > 20 || omerDay === 10 || omerDay === 20) {\n str += tens[ten];\n }\n if (omerDay < 11) {\n str += ones[one] + ' ' + yamim + ' ';\n } else {\n str += ' ' + yom + ' ';\n }\n } else if (omerDay === 1) {\n str += yomEchad + ' ';\n } else {\n // omer == 2\n str += shneiYamim + ' ';\n }\n if (omerDay > 6) {\n str = str.trim(); // remove trailing space before comma\n str += ', שֶׁהֵם ';\n const weeks: number = Math.floor(omerDay / 7);\n const days: number = omerDay % 7;\n if (weeks > 2) {\n str += ones[weeks] + ' ' + shavuot + ' ';\n } else if (weeks === 1) {\n str += 'שָׁבֽוּעַ' + ' ' + ones[1] + ' ';\n } else {\n // weeks == 2\n str += shnei + ' ' + shavuot + ' ';\n }\n if (days) {\n if (days === 2 || days === 3) {\n str += 'וּ';\n } else if (days === 5) {\n str += 'וַ';\n } else {\n str += 'וְ';\n }\n if (days > 2) {\n str += ones[days] + ' ' + yamim + ' ';\n } else if (days === 1) {\n str += yomEchad + ' ';\n } else {\n // days == 2\n str += shneiYamim + ' ';\n }\n }\n }\n str += 'לָעֽוֹמֶר';\n return str.normalize();\n}\n\nconst anaBekoach = sefira.anaBekoach;\n\nconst ps67lines = sefira.ps67lines;\n\nconst lamnatzeach = ps67lines.flatMap((x: string) => x.split(/[ ־]/));\n\nconst lamnatzeachLetters = sefira.lamnatzeachLetters.split('');\n\n/** Represents a day 1-49 of counting the Omer from Pesach to Shavuot */\nexport class OmerEvent extends Event {\n private readonly weekNumber: number;\n private readonly daysWithinWeeks: number;\n readonly omer: number;\n\n /**\n * @param date\n * @param omerDay\n */\n constructor(date: HDate, omerDay: number) {\n super(date, `Omer ${omerDay}`, flags.OMER_COUNT);\n checkDay(omerDay);\n this.weekNumber = Math.floor((omerDay - 1) / 7) + 1;\n this.daysWithinWeeks = omerDay % 7 || 7;\n this.omer = omerDay;\n }\n\n /**\n * Returns the sefira. For example, on day 8:\n * * חֶֽסֶד שֶׁבִּגְבוּרָה\n * * Chesed shebiGevurah\n * * Lovingkindness within Might\n * @param lang `en` (English), `he` (Hebrew with nikud), or `translit` (Hebrew in Sephardic transliteration)\n * @returns a string such as `Lovingkindness within Might` or `חֶֽסֶד שֶׁבִּגְבוּרָה`\n */\n sefira(lang: OmerLang = 'en'): string {\n if (lang !== 'he' && lang !== 'translit') {\n lang = 'en';\n }\n const [weekNum, daysWithinWeeks]: number[] = getWeeks(this.omer);\n const config = sefirot[lang as OmerLang];\n const pfxWords = config.pfxWords;\n const words = config.words;\n const week = pfxWords ? pfxWords[weekNum] : words[weekNum];\n const dayWithinWeek = words[daysWithinWeeks];\n const infix = pfxWords\n ? ''\n : weekNum === 2 || weekNum === 6\n ? config.infix26\n : config.infix;\n return (dayWithinWeek + ' ' + infix + week).normalize();\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n render(locale?: string): string {\n const isHebrewLocale = Locale.isHebrewLocale(locale);\n const omer = this.omer;\n const nth = isHebrewLocale ? gematriya(omer) : Locale.ordinal(omer, locale);\n return nth + ' ' + Locale.gettext('day of the Omer', locale);\n }\n /**\n * Returns translation of \"Omer day 22\" without ordinal numbers.\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n renderBrief(locale?: string): string {\n return (\n Locale.gettext('Omer', locale) +\n ' ' +\n Locale.gettext('day', locale) +\n ' ' +\n this.omer\n );\n }\n /**\n * Returns an emoji number symbol with a circle, for example `㊲`\n * from the “Enclosed CJK Letters and Months” block of the Unicode standard\n * @returns a single Unicode character from `①` through `㊾`\n */\n getEmoji(): string {\n if (typeof this.emoji === 'string') return this.emoji;\n let codePoint: number;\n const omerDay = this.omer;\n if (omerDay <= 20) {\n codePoint = 9312 + omerDay - 1;\n } else if (omerDay <= 35) {\n // between 21 and 35 inclusive\n codePoint = 12881 + omerDay - 21;\n } else {\n // between 36 and 49 inclusive\n codePoint = 12977 + omerDay - 36;\n }\n return String.fromCodePoint(codePoint);\n }\n\n getWeeks(): number {\n const day7 = this.daysWithinWeeks === 7;\n return day7 ? this.weekNumber : this.weekNumber - 1;\n }\n\n getDaysWithinWeeks(): number {\n return this.daysWithinWeeks;\n }\n /**\n * Returns a sentence with that evening's omer count\n * @returns a string such as `Today is 10 days, which is 1 week and 3 days of the Omer`\n * or `הַיוֹם עֲשָׂרָה יָמִים, שְׁהֵם שָׁבוּעַ אֶחָד וְשְׁלוֹשָׁה יָמִים לָעוֹמֶר`\n */\n getTodayIs(locale: string): string {\n locale = (locale || 'en').toLowerCase();\n const isHebrew = Locale.isHebrewLocale(locale);\n const str = isHebrew ? omerTodayIsHe(this.omer) : omerTodayIsEn(this.omer);\n if (locale === 'he-x-nonikud') {\n return Locale.hebrewStripNikkud(str);\n }\n return str;\n }\n\n url(): string | undefined {\n const year = this.getDate().getFullYear();\n if (year < 5000 || year > 6759) {\n return undefined;\n }\n return `https://www.hebcal.com/omer/${year}/${this.omer}`;\n }\n\n /**\n * Returns the word from Psalm 67 (לַמְנַצֵּחַ, \"Lamnatzeach\") corresponding\n * to this Omer day. Psalm 67 contains 49 words (excluding its opening verse),\n * one for each day of the Omer. The words are taken from verses 2–8, split on\n * spaces and maqef (־).\n * @returns a Hebrew word from Psalm 67\n * @example\n * const ev = new OmerEvent(new HDate(16, 'Nisan', 5785), 1);\n * ev.getLamnatzeachWord(); // 'אֱלֹהִים' (day 1, first word of verse 2)\n * @example\n * const ev = new OmerEvent(new HDate(3, 'Sivan', 5785), 49);\n * ev.getLamnatzeachWord(); // 'אָרֶץ' (day 49, last word of verse 8)\n */\n getLamnatzeachWord(): string {\n return lamnatzeach[this.omer - 1];\n }\n\n /**\n * Returns the letter from verse 5 of Psalm 67 corresponding to this Omer day.\n * Verse 5 (יִשְׂמְחוּ וִירַנְּנוּ לְאֻמִּים…) contains exactly 49 letters,\n * one for each day of the Omer, and is used as a Kabbalistic meditation during\n * the counting.\n * @returns a single Hebrew letter from verse 5 of Psalm 67\n * @example\n * const ev = new OmerEvent(new HDate(16, 'Nisan', 5785), 1);\n * ev.getLamnatzeachLetter(); // 'י' (day 1, first letter of verse 5)\n * @example\n * const ev = new OmerEvent(new HDate(3, 'Sivan', 5785), 49);\n * ev.getLamnatzeachLetter(); // 'ה' (day 49, last letter of verse 5)\n */\n getLamnatzeachLetter(): string {\n return lamnatzeachLetters[this.omer - 1];\n }\n\n /**\n * Returns the word from the Ana BeKoach prayer (אָנָּא בְּכֹחַ) corresponding\n * to this Omer day. Ana BeKoach is a 42-word Kabbalistic prayer whose initial\n * letters spell out the 42-letter name of God. The prayer has 7 verses of\n * 6 words each; the 7th entry of each group is the abbreviation of the acrostic\n * letters for that verse (e.g. `אב״ג ית״ץ` for verse 1). Together the 49\n * entries (7 verses × 7 entries) align with the 49 days of the Omer, connecting\n * each day to one of the lower seven Sefirot within a Sefirah.\n * @returns a Hebrew word or verse-abbreviation string from Ana BeKoach\n * @example\n * const ev = new OmerEvent(new HDate(16, 'Nisan', 5785), 1);\n * ev.getAnaBekoachWord(); // 'אָנָּא' (day 1, first word of verse 1)\n * @example\n * const ev = new OmerEvent(new HDate(22, 'Nisan', 5785), 7);\n * ev.getAnaBekoachWord(); // 'אב״ג ית״ץ' (day 7, acrostic abbreviation for verse 1)\n * @example\n * const ev = new OmerEvent(new HDate(3, 'Sivan', 5785), 49);\n * ev.getAnaBekoachWord(); // 'שק״ו צי״ת' (day 49, acrostic abbreviation for verse 7)\n */\n getAnaBekoachWord(): string {\n return anaBekoach[this.omer - 1].normalize();\n }\n}\n"],"names":[],"mappings":";;;;;;AAWA,MAAM,OAAO,GAAG;AACd,IAAA,EAAE,EAAE;AACF,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,OAAO,EAAE,SAAS;AAClB,QAAA,KAAK,EAAE;YACL,EAAE;YACF,gBAAgB;YAChB,OAAO;YACP,QAAQ;YACR,UAAU;YACV,UAAU;YACV,YAAY;YACZ,SAAS;AACV,SAAA;AACD,QAAA,QAAQ,EAAE,IAAI;AACf,KAAA;AACD,IAAA,EAAE,EAAE;AACF,QAAA,KAAK,EAAE,IAAI;AACX,QAAA,OAAO,EAAE,IAAI;AACb,QAAA,KAAK,EAAE;YACL,EAAE;YACF,QAAQ;YACR,WAAW;YACX,aAAa;YACb,SAAS;YACT,MAAM;YACN,SAAS;YACT,UAAU;AACX,SAAA;AACD,QAAA,QAAQ,EAAE;YACR,EAAE;YACF,cAAc;YACd,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OAAO,IAAI,CAAC,eAAe;IAC7B;AACA;;;;AAIG;AACH,IAAA,UAAU,CAAC,MAAc,EAAA;QACvB,MAAM,GAAG,CAAC,MAAM,IAAI,IAAI,EAAE,WAAW,EAAE;QACvC,MAAM,QAAQ,GAAG,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC;QAC9C,MAAM,GAAG,GAAG,QAAQ,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;AAC1E,QAAA,IAAI,MAAM,KAAK,cAAc,EAAE;AAC7B,YAAA,OAAO,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC;QACtC;AACA,QAAA,OAAO,GAAG;IACZ;IAEA,GAAG,GAAA;QACD,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,WAAW,EAAE;QACzC,IAAI,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,IAAI,EAAE;AAC9B,YAAA,OAAO,SAAS;QAClB;AACA,QAAA,OAAO,+BAA+B,IAAI,CAAA,CAAA,EAAI,IAAI,CAAC,IAAI,EAAE;IAC3D;AAEA;;;;;;;;;;;;AAYG;IACH,kBAAkB,GAAA;QAChB,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;IACnC;AAEA;;;;;;;;;;;;AAYG;IACH,oBAAoB,GAAA;QAClB,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;IAC1C;AAEA;;;;;;;;;;;;;;;;;;AAkBG;IACH,iBAAiB,GAAA;QACf,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE;IAC9C;AACD;;;;"}
1
+ {"version":3,"file":"omer.js","sources":["../../../src/omer.ts"],"sourcesContent":["import {HDate, Locale, gematriya} from '@hebcal/hdate';\nimport {Event, flags} from './event';\nimport './locale'; // Adds Hebrew and Ashkenazic translations\nimport sefira from './sefira.json';\n\n/**\n * Language for counting the Omer can be English or Hebrew.\n * Lang for the Sefira can be English, Hebrew, or Hebrew in Sephardic transliteration.\n */\nexport type OmerLang = 'en' | 'he' | 'translit';\n\nconst sefirot = {\n en: {\n infix: 'within ',\n infix26: 'within ',\n words: [\n '',\n 'Lovingkindness',\n 'Might',\n 'Beauty',\n 'Eternity',\n 'Splendor',\n 'Foundation',\n 'Majesty',\n ],\n pfxWords: null,\n },\n he: {\n infix: null,\n infix26: null,\n words: [\n '',\n 'חֶֽסֶד',\n 'גְּבוּרָה',\n 'תִּפְאֶֽרֶת',\n 'נֶּֽצַח',\n 'הוֹד',\n 'יְּסוֹד',\n 'מַלְכוּת',\n ],\n pfxWords: [\n '',\n 'שֶׁבְּחֶֽסֶד',\n 'שֶׁבִּגְבוּרָה',\n 'שֶׁבְּתִפְאֶֽרֶת',\n 'שֶׁבְּנֶֽצַח',\n 'שֶׁבְּהוֹד',\n 'שֶׁבִּיְסוֹד',\n 'שֶׁבְּמַלְכוּת',\n ],\n },\n translit: {\n infix: \"sheb'\",\n infix26: 'shebi',\n words: [\n '',\n 'Chesed',\n 'Gevurah',\n 'Tiferet',\n 'Netzach',\n 'Hod',\n 'Yesod',\n 'Malkhut',\n ],\n pfxWords: null,\n },\n} as const;\n\nfunction checkDay(omerDay: number): void {\n if (omerDay < 1 || omerDay > 49) {\n throw new RangeError(`Invalid Omer day ${omerDay}`);\n }\n}\n\nfunction getWeeks(omerDay: number): number[] {\n const weekNum: number = Math.floor((omerDay - 1) / 7) + 1;\n const daysWithinWeeks: number = omerDay % 7 || 7;\n return [weekNum, daysWithinWeeks];\n}\n\nfunction omerTodayIsEn(omerDay: number): string {\n const [weekNumber, daysWithinWeeks]: number[] = getWeeks(omerDay);\n\n const totalDaysStr: string = omerDay === 1 ? 'day' : 'days';\n let str = `Today is ${omerDay} ${totalDaysStr}`;\n\n if (weekNumber > 1 || omerDay === 7) {\n const day7: boolean = daysWithinWeeks === 7;\n const numWeeks: number = day7 ? weekNumber : weekNumber - 1;\n const weeksStr: string = numWeeks === 1 ? 'week' : 'weeks';\n str += `, which are ${numWeeks} ${weeksStr}`;\n if (!day7) {\n const daysStr: string = daysWithinWeeks === 1 ? 'day' : 'days';\n str += ` and ${daysWithinWeeks} ${daysStr}`;\n }\n }\n return str + ' of the Omer';\n}\n\n// adapted from pip hdate package (GPL)\n// https://github.com/py-libhdate/py-libhdate/blob/master/hdate/date.py\n\nconst tens = ['', 'עֲשָׂרָה', 'עֶשְׂרִים', 'שְׁלוֹשִׁים', 'אַרְבָּעִים'];\nconst ones = [\n '',\n 'אֶחָד',\n 'שְׁנַיִם',\n 'שְׁלוֹשָׁה',\n 'אַרְבָּעָה',\n 'חֲמִשָּׁה',\n 'שִׁשָּׁה',\n 'שִׁבְעָה',\n 'שְׁמוֹנָה',\n 'תִּשְׁעָה',\n];\n\nconst shnei = 'שְׁנֵי';\nconst yamim = 'יָמִים';\nconst shneiYamim = shnei + ' ' + yamim;\nconst shavuot = 'שָׁבוּעוֹת';\nconst yom = 'יוֹם';\nconst yomEchad = yom + ' ' + ones[1];\nconst asar = 'עָשָׂר';\n\nfunction omerTodayIsHe(omerDay: number): string {\n const ten: number = Math.floor(omerDay / 10);\n const one: number = omerDay % 10;\n let str = 'הַיּוֹם ';\n if (omerDay === 11) {\n str += 'אַחַד ' + asar;\n } else if (omerDay === 12) {\n str += 'שְׁנֵים ' + asar;\n } else if (12 < omerDay && omerDay < 20) {\n str += ones[one] + ' ' + asar;\n } else if (omerDay > 9) {\n str += ones[one];\n if (one) {\n str += ' ';\n str += ten === 3 ? 'וּ' : 'וְ';\n }\n }\n if (omerDay > 2) {\n if (omerDay > 20 || omerDay === 10 || omerDay === 20) {\n str += tens[ten];\n }\n if (omerDay < 11) {\n str += ones[one] + ' ' + yamim + ' ';\n } else {\n str += ' ' + yom + ' ';\n }\n } else if (omerDay === 1) {\n str += yomEchad + ' ';\n } else {\n // omer == 2\n str += shneiYamim + ' ';\n }\n if (omerDay > 6) {\n str = str.trim(); // remove trailing space before comma\n str += ', שֶׁהֵם ';\n const weeks: number = Math.floor(omerDay / 7);\n const days: number = omerDay % 7;\n if (weeks > 2) {\n str += ones[weeks] + ' ' + shavuot + ' ';\n } else if (weeks === 1) {\n str += 'שָׁבֽוּעַ' + ' ' + ones[1] + ' ';\n } else {\n // weeks == 2\n str += shnei + ' ' + shavuot + ' ';\n }\n if (days) {\n if (days === 2 || days === 3) {\n str += 'וּ';\n } else if (days === 5) {\n str += 'וַ';\n } else {\n str += 'וְ';\n }\n if (days > 2) {\n str += ones[days] + ' ' + yamim + ' ';\n } else if (days === 1) {\n str += yomEchad + ' ';\n } else {\n // days == 2\n str += shneiYamim + ' ';\n }\n }\n }\n str += 'לָעֽוֹמֶר';\n return str.normalize();\n}\n\nconst anaBekoach = sefira.anaBekoach;\n\nconst ps67lines = sefira.ps67lines;\n\nconst lamnatzeach = ps67lines.flatMap((x: string) => x.split(/[ ־]/));\n\nconst lamnatzeachLetters = sefira.lamnatzeachLetters.split('');\n\n/**\n * Represents one of the 49 days of counting the Omer between Pesach and\n * Shavuot (16 Nisan through 5 Sivan).\n *\n * Each day has an associated Sefirah pairing (e.g. *Chesed shebiGevurah*),\n * a word from Psalm 67 (Lamnatzeach), a letter from verse 5 of Psalm 67,\n * and a word/acrostic from the Ana BeKoach prayer — all accessible via\n * the methods on this class.\n *\n * @example\n * import {OmerEvent, HDate, months} from '@hebcal/core';\n * const ev = new OmerEvent(new HDate(16, months.NISAN, 5784), 1);\n * ev.render('en'); // '1st day of the Omer'\n * ev.render('he'); // 'א׳ בָּעוֹמֶר'\n * ev.sefira('translit'); // 'Chesed shebChesed'\n * ev.getTodayIs('en'); // 'Today is 1 day of the Omer'\n */\nexport class OmerEvent extends Event {\n private readonly weekNumber: number;\n private readonly daysWithinWeeks: number;\n readonly omer: number;\n\n /**\n * Constructs an Omer event for a given day (1–49).\n *\n * Throws `RangeError` if `omerDay` is outside 1–49.\n * @param date Hebrew date this Omer day is counted on (the evening of)\n * @param omerDay day of the Omer, 1 through 49\n */\n constructor(date: HDate, omerDay: number) {\n super(date, `Omer ${omerDay}`, flags.OMER_COUNT);\n checkDay(omerDay);\n this.weekNumber = Math.floor((omerDay - 1) / 7) + 1;\n this.daysWithinWeeks = omerDay % 7 || 7;\n this.omer = omerDay;\n }\n\n /**\n * Returns the Sefirah pairing associated with this Omer day —\n * one of the seven lower Sefirot within another, calculated as\n * `day-within-week` of `week-within-cycle`. For example, on day 8\n * (week 2, day 1):\n * * חֶֽסֶד שֶׁבִּגְבוּרָה\n * * Chesed shebiGevurah\n * * Lovingkindness within Might\n * @example\n * import {OmerEvent, HDate, months} from '@hebcal/core';\n * const day8 = new OmerEvent(new HDate(23, months.NISAN, 5784), 8);\n * day8.sefira('en'); // 'Lovingkindness within Might'\n * day8.sefira('he'); // 'חֶֽסֶד שֶׁבִּגְבוּרָה'\n * day8.sefira('translit'); // 'Chesed shebiGevurah'\n * @param lang `en` (English), `he` (Hebrew with nikud), or `translit` (Hebrew in Sephardic transliteration)\n * @returns a string such as `Lovingkindness within Might` or `חֶֽסֶד שֶׁבִּגְבוּרָה`\n */\n sefira(lang: OmerLang = 'en'): string {\n if (lang !== 'he' && lang !== 'translit') {\n lang = 'en';\n }\n const [weekNum, daysWithinWeeks]: number[] = getWeeks(this.omer);\n const config = sefirot[lang as OmerLang];\n const pfxWords = config.pfxWords;\n const words = config.words;\n const week = pfxWords ? pfxWords[weekNum] : words[weekNum];\n const dayWithinWeek = words[daysWithinWeeks];\n const infix = pfxWords\n ? ''\n : weekNum === 2 || weekNum === 6\n ? config.infix26\n : config.infix;\n return (dayWithinWeek + ' ' + infix + week).normalize();\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n render(locale?: string): string {\n const isHebrewLocale = Locale.isHebrewLocale(locale);\n const omer = this.omer;\n const nth = isHebrewLocale ? gematriya(omer) : Locale.ordinal(omer, locale);\n return nth + ' ' + Locale.gettext('day of the Omer', locale);\n }\n /**\n * Returns translation of \"Omer day 22\" without ordinal numbers.\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n renderBrief(locale?: string): string {\n return (\n Locale.gettext('Omer', locale) +\n ' ' +\n Locale.gettext('day', locale) +\n ' ' +\n this.omer\n );\n }\n /**\n * Returns an emoji number symbol with a circle, for example `㊲`\n * from the “Enclosed CJK Letters and Months” block of the Unicode standard\n * @returns a single Unicode character from `①` through `㊾`\n */\n getEmoji(): string {\n if (typeof this.emoji === 'string') return this.emoji;\n let codePoint: number;\n const omerDay = this.omer;\n if (omerDay <= 20) {\n codePoint = 9312 + omerDay - 1;\n } else if (omerDay <= 35) {\n // between 21 and 35 inclusive\n codePoint = 12881 + omerDay - 21;\n } else {\n // between 36 and 49 inclusive\n codePoint = 12977 + omerDay - 36;\n }\n return String.fromCodePoint(codePoint);\n }\n\n getWeeks(): number {\n const day7 = this.daysWithinWeeks === 7;\n return day7 ? this.weekNumber : this.weekNumber - 1;\n }\n\n getDaysWithinWeeks(): number {\n return this.daysWithinWeeks;\n }\n /**\n * Returns a sentence with that evening's omer count\n * @returns a string such as `Today is 10 days, which is 1 week and 3 days of the Omer`\n * or `הַיוֹם עֲשָׂרָה יָמִים, שְׁהֵם שָׁבוּעַ אֶחָד וְשְׁלוֹשָׁה יָמִים לָעוֹמֶר`\n */\n getTodayIs(locale: string): string {\n locale = (locale || 'en').toLowerCase();\n const isHebrew = Locale.isHebrewLocale(locale);\n const str = isHebrew ? omerTodayIsHe(this.omer) : omerTodayIsEn(this.omer);\n if (locale === 'he-x-nonikud') {\n return Locale.hebrewStripNikkud(str);\n }\n return str;\n }\n\n url(): string | undefined {\n const year = this.getDate().getFullYear();\n if (year < 5000 || year > 6759) {\n return undefined;\n }\n return `https://www.hebcal.com/omer/${year}/${this.omer}`;\n }\n\n /**\n * Returns the word from Psalm 67 (לַמְנַצֵּחַ, \"Lamnatzeach\") corresponding\n * to this Omer day. Psalm 67 contains 49 words (excluding its opening verse),\n * one for each day of the Omer. The words are taken from verses 2–8, split on\n * spaces and maqef (־).\n * @returns a Hebrew word from Psalm 67\n * @example\n * const ev = new OmerEvent(new HDate(16, 'Nisan', 5785), 1);\n * ev.getLamnatzeachWord(); // 'אֱלֹהִים' (day 1, first word of verse 2)\n * @example\n * const ev = new OmerEvent(new HDate(3, 'Sivan', 5785), 49);\n * ev.getLamnatzeachWord(); // 'אָרֶץ' (day 49, last word of verse 8)\n */\n getLamnatzeachWord(): string {\n return lamnatzeach[this.omer - 1];\n }\n\n /**\n * Returns the letter from verse 5 of Psalm 67 corresponding to this Omer day.\n * Verse 5 (יִשְׂמְחוּ וִירַנְּנוּ לְאֻמִּים…) contains exactly 49 letters,\n * one for each day of the Omer, and is used as a Kabbalistic meditation during\n * the counting.\n * @returns a single Hebrew letter from verse 5 of Psalm 67\n * @example\n * const ev = new OmerEvent(new HDate(16, 'Nisan', 5785), 1);\n * ev.getLamnatzeachLetter(); // 'י' (day 1, first letter of verse 5)\n * @example\n * const ev = new OmerEvent(new HDate(3, 'Sivan', 5785), 49);\n * ev.getLamnatzeachLetter(); // 'ה' (day 49, last letter of verse 5)\n */\n getLamnatzeachLetter(): string {\n return lamnatzeachLetters[this.omer - 1];\n }\n\n /**\n * Returns the word from the Ana BeKoach prayer (אָנָּא בְּכֹחַ) corresponding\n * to this Omer day. Ana BeKoach is a 42-word Kabbalistic prayer whose initial\n * letters spell out the 42-letter name of God. The prayer has 7 verses of\n * 6 words each; the 7th entry of each group is the abbreviation of the acrostic\n * letters for that verse (e.g. `אב״ג ית״ץ` for verse 1). Together the 49\n * entries (7 verses × 7 entries) align with the 49 days of the Omer, connecting\n * each day to one of the lower seven Sefirot within a Sefirah.\n * @returns a Hebrew word or verse-abbreviation string from Ana BeKoach\n * @example\n * const ev = new OmerEvent(new HDate(16, 'Nisan', 5785), 1);\n * ev.getAnaBekoachWord(); // 'אָנָּא' (day 1, first word of verse 1)\n * @example\n * const ev = new OmerEvent(new HDate(22, 'Nisan', 5785), 7);\n * ev.getAnaBekoachWord(); // 'אב״ג ית״ץ' (day 7, acrostic abbreviation for verse 1)\n * @example\n * const ev = new OmerEvent(new HDate(3, 'Sivan', 5785), 49);\n * ev.getAnaBekoachWord(); // 'שק״ו צי״ת' (day 49, acrostic abbreviation for verse 7)\n */\n getAnaBekoachWord(): string {\n return anaBekoach[this.omer - 1].normalize();\n }\n}\n"],"names":[],"mappings":";;;;;;AAWA,MAAM,OAAO,GAAG;AACd,IAAA,EAAE,EAAE;AACF,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,OAAO,EAAE,SAAS;AAClB,QAAA,KAAK,EAAE;YACL,EAAE;YACF,gBAAgB;YAChB,OAAO;YACP,QAAQ;YACR,UAAU;YACV,UAAU;YACV,YAAY;YACZ,SAAS;AACV,SAAA;AACD,QAAA,QAAQ,EAAE,IAAI;AACf,KAAA;AACD,IAAA,EAAE,EAAE;AACF,QAAA,KAAK,EAAE,IAAI;AACX,QAAA,OAAO,EAAE,IAAI;AACb,QAAA,KAAK,EAAE;YACL,EAAE;YACF,QAAQ;YACR,WAAW;YACX,aAAa;YACb,SAAS;YACT,MAAM;YACN,SAAS;YACT,UAAU;AACX,SAAA;AACD,QAAA,QAAQ,EAAE;YACR,EAAE;YACF,cAAc;YACd,gBAAgB;YAChB,kBAAkB;YAClB,cAAc;YACd,YAAY;YACZ,cAAc;YACd,gBAAgB;AACjB,SAAA;AACF,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,KAAK,EAAE,OAAO;AACd,QAAA,OAAO,EAAE,OAAO;AAChB,QAAA,KAAK,EAAE;YACL,EAAE;YACF,QAAQ;YACR,SAAS;YACT,SAAS;YACT,SAAS;YACT,KAAK;YACL,OAAO;YACP,SAAS;AACV,SAAA;AACD,QAAA,QAAQ,EAAE,IAAI;AACf,KAAA;CACO;AAEV,SAAS,QAAQ,CAAC,OAAe,EAAA;IAC/B,IAAI,OAAO,GAAG,CAAC,IAAI,OAAO,GAAG,EAAE,EAAE;AAC/B,QAAA,MAAM,IA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C;AACA,QAAA,OAAO,GAAG;IACZ;IAEA,GAAG,GAAA;QACD,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,WAAW,EAAE;QACzC,IAAI,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,IAAI,EAAE;AAC9B,YAAA,OAAO,SAAS;QAClB;AACA,QAAA,OAAO,+BAA+B,IAAI,CAAA,CAAA,EAAI,IAAI,CAAC,IAAI,EAAE;IAC3D;AAEA;;;;;;;;;;;;AAYG;IACH,kBAAkB,GAAA;QAChB,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;IACnC;AAEA;;;;;;;;;;;;AAYG;IACH,oBAAoB,GAAA;QAClB,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;IAC1C;AAEA;;;;;;;;;;;;;;;;;;AAkBG;IACH,iBAAiB,GAAA;QACf,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE;IAC9C;AACD;;;;"}
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.5.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.5.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import './locale.js';
3
3
  import { Locale } from '@hebcal/hdate';
4
4
 
@@ -1,6 +1,17 @@
1
1
  import { ParshaEvent } from './ParshaEvent';
2
2
  /**
3
- * Calculates weekly Torah Reading on Saturdays for entire year
3
+ * Calculates the weekly Torah Reading (Parashat HaShavua) on Saturdays for
4
+ * an entire Hebrew year.
5
+ *
6
+ * Saturdays on which a Yom Tov reading displaces the regular parsha
7
+ * (e.g. Shabbat Chol ha-Moed Pesach/Sukkot, Yom Kippur on Shabbat) are
8
+ * skipped — for those use {@link getHolidaysOnDate} or
9
+ * {@link Sedra.lookup}.
10
+ * @example
11
+ * import {parshaYear} from '@hebcal/core';
12
+ * const events = parshaYear(5784, false);
13
+ * events[0].render('en'); // 'Parashat Vayeilech'
14
+ * events[0].getDate().toString(); // '4 Tishrei 5784'
4
15
  * @param year Hebrew year
5
16
  * @param il Israel (false for Diaspora)
6
17
  * @returns an array of `ParshaEvent` occurring on Saturdays that contain a regular
@@ -1,10 +1,21 @@
1
- /*! @hebcal/core v6.5.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.5.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { HDate, months } from '@hebcal/hdate';
3
3
  import { ParshaEvent } from './ParshaEvent.js';
4
4
  import { getSedra } from './sedra.js';
5
5
 
6
6
  /**
7
- * Calculates weekly Torah Reading on Saturdays for entire year
7
+ * Calculates the weekly Torah Reading (Parashat HaShavua) on Saturdays for
8
+ * an entire Hebrew year.
9
+ *
10
+ * Saturdays on which a Yom Tov reading displaces the regular parsha
11
+ * (e.g. Shabbat Chol ha-Moed Pesach/Sukkot, Yom Kippur on Shabbat) are
12
+ * skipped — for those use {@link getHolidaysOnDate} or
13
+ * {@link Sedra.lookup}.
14
+ * @example
15
+ * import {parshaYear} from '@hebcal/core';
16
+ * const events = parshaYear(5784, false);
17
+ * events[0].render('en'); // 'Parashat Vayeilech'
18
+ * events[0].getDate().toString(); // '4 Tishrei 5784'
8
19
  * @param year Hebrew year
9
20
  * @param il Israel (false for Diaspora)
10
21
  * @returns an array of `ParshaEvent` occurring on Saturdays that contain a regular
@@ -1 +1 @@
1
- {"version":3,"file":"parshaYear.js","sources":["../../../src/parshaYear.ts"],"sourcesContent":["import {HDate, months} from '@hebcal/hdate';\nimport {ParshaEvent} from './ParshaEvent';\nimport {getSedra} from './sedra';\n\n/**\n * Calculates weekly Torah Reading on Saturdays for entire year\n * @param year Hebrew year\n * @param il Israel (false for Diaspora)\n * @returns an array of `ParshaEvent` occurring on Saturdays that contain a regular\n * (non-holiday) Parashat HaShavua\n */\nexport function parshaYear(year: number, il: boolean): ParshaEvent[] {\n const sedra = getSedra(year, il);\n const startAbs = sedra.getFirstSaturday();\n const endAbs = HDate.hebrew2abs(year, months.ELUL, 29);\n const events: ParshaEvent[] = [];\n for (let absDt = startAbs; absDt <= endAbs; absDt += 7) {\n const parsha = sedra.lookup(absDt);\n if (!parsha.chag) {\n const ev = new ParshaEvent(parsha);\n events.push(ev);\n }\n }\n return events;\n}\n"],"names":[],"mappings":";;;;;AAIA;;;;;;AAMG;AACG,SAAU,UAAU,CAAC,IAAY,EAAE,EAAW,EAAA;IAClD,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;AAChC,IAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,gBAAgB,EAAE;AACzC,IAAA,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;IACtD,MAAM,MAAM,GAAkB,EAAE;AAChC,IAAA,KAAK,IAAI,KAAK,GAAG,QAAQ,EAAE,KAAK,IAAI,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE;QACtD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;AAClC,QAAA,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;AAChB,YAAA,MAAM,EAAE,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC;AAClC,YAAA,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QACjB;IACF;AACA,IAAA,OAAO,MAAM;AACf;;;;"}
1
+ {"version":3,"file":"parshaYear.js","sources":["../../../src/parshaYear.ts"],"sourcesContent":["import {HDate, months} from '@hebcal/hdate';\nimport {ParshaEvent} from './ParshaEvent';\nimport {getSedra} from './sedra';\n\n/**\n * Calculates the weekly Torah Reading (Parashat HaShavua) on Saturdays for\n * an entire Hebrew year.\n *\n * Saturdays on which a Yom Tov reading displaces the regular parsha\n * (e.g. Shabbat Chol ha-Moed Pesach/Sukkot, Yom Kippur on Shabbat) are\n * skipped — for those use {@link getHolidaysOnDate} or\n * {@link Sedra.lookup}.\n * @example\n * import {parshaYear} from '@hebcal/core';\n * const events = parshaYear(5784, false);\n * events[0].render('en'); // 'Parashat Vayeilech'\n * events[0].getDate().toString(); // '4 Tishrei 5784'\n * @param year Hebrew year\n * @param il Israel (false for Diaspora)\n * @returns an array of `ParshaEvent` occurring on Saturdays that contain a regular\n * (non-holiday) Parashat HaShavua\n */\nexport function parshaYear(year: number, il: boolean): ParshaEvent[] {\n const sedra = getSedra(year, il);\n const startAbs = sedra.getFirstSaturday();\n const endAbs = HDate.hebrew2abs(year, months.ELUL, 29);\n const events: ParshaEvent[] = [];\n for (let absDt = startAbs; absDt <= endAbs; absDt += 7) {\n const parsha = sedra.lookup(absDt);\n if (!parsha.chag) {\n const ev = new ParshaEvent(parsha);\n events.push(ev);\n }\n }\n return events;\n}\n"],"names":[],"mappings":";;;;;AAIA;;;;;;;;;;;;;;;;;AAiBG;AACG,SAAU,UAAU,CAAC,IAAY,EAAE,EAAW,EAAA;IAClD,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;AAChC,IAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,gBAAgB,EAAE;AACzC,IAAA,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;IACtD,MAAM,MAAM,GAAkB,EAAE;AAChC,IAAA,KAAK,IAAI,KAAK,GAAG,QAAQ,EAAE,KAAK,IAAI,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE;QACtD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;AAClC,QAAA,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;AAChB,YAAA,MAAM,EAAE,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC;AAClC,YAAA,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QACjB;IACF;AACA,IAAA,OAAO,MAAM;AACf;;;;"}
@@ -1,2 +1,2 @@
1
1
  /** DO NOT EDIT THIS AUTO-GENERATED FILE! */
2
- export declare const version = "6.5.0";
2
+ export declare const version = "6.5.2";
@@ -1,6 +1,6 @@
1
- /*! @hebcal/core v6.5.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.5.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  /** DO NOT EDIT THIS AUTO-GENERATED FILE! */
3
- const version = '6.5.0';
3
+ const version = '6.5.2';
4
4
 
5
5
  export { version };
6
6
  //# sourceMappingURL=pkgVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pkgVersion.js","sources":["../../../src/pkgVersion.ts"],"sourcesContent":["/** DO NOT EDIT THIS AUTO-GENERATED FILE! */\nexport const version = '6.5.0';\n"],"names":[],"mappings":";AAAA;AACO,MAAM,OAAO,GAAG;;;;"}
1
+ {"version":3,"file":"pkgVersion.js","sources":["../../../src/pkgVersion.ts"],"sourcesContent":["/** DO NOT EDIT THIS AUTO-GENERATED FILE! */\nexport const version = '6.5.2';\n"],"names":[],"mappings":";AAAA;AACO,MAAM,OAAO,GAAG;;;;"}
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.5.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.5.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  const hour12cc = {
3
3
  US: 1,
4
4
  CA: 1,
@@ -27,7 +27,23 @@ export type SedraResult = {
27
27
  il: boolean;
28
28
  };
29
29
  /**
30
- * Represents Parashah HaShavua for an entire Hebrew year
30
+ * Represents the weekly Torah-reading (Parashat HaShavua) schedule for an
31
+ * entire Hebrew year.
32
+ *
33
+ * The schedule depends on the year's *keviyah* — the day of week of Rosh
34
+ * Hashana, whether the year is leap, whether Cheshvan/Kislev are long or
35
+ * short, and whether the schedule is for Israel or the Diaspora (since
36
+ * Israel and the Diaspora diverge in some years when the 8th day of Pesach
37
+ * or the 2nd day of Shavuot fall on Shabbat).
38
+ *
39
+ * Prefer {@link getSedra} (or {@link HebrewCalendar.getSedra}) over
40
+ * calling this constructor directly, since both cache their results.
41
+ *
42
+ * @example
43
+ * import {Sedra, HDate, months} from '@hebcal/core';
44
+ * const sedra = new Sedra(5784, false);
45
+ * const result = sedra.lookup(new HDate(15, months.CHESHVAN, 5784));
46
+ * console.log(result.parsha); // ['Lech-Lecha']
31
47
  */
32
48
  export declare class Sedra {
33
49
  private readonly year;
@@ -37,14 +53,29 @@ export declare class Sedra {
37
53
  private readonly theSedraArray;
38
54
  private readonly yearKey;
39
55
  /**
40
- * Caculates the Parashah HaShavua for an entire Hebrew year
56
+ * Calculates the Parashat HaShavua schedule for an entire Hebrew year.
41
57
  * @param hyear - Hebrew year (e.g. 5749)
42
58
  * @param il - Use Israel sedra schedule (false for Diaspora)
43
59
  */
44
60
  constructor(hyear: number, il: boolean);
45
61
  /**
46
- * Returns the date that a parsha occurs
47
- * or `null` if the parsha doesn't occur this year
62
+ * Returns the date a parsha is read this year, or `null` if it does not
63
+ * occur in this year's schedule.
64
+ *
65
+ * A doubled parsha (e.g. `'Matot-Masei'`) will only return a date in years
66
+ * where that pair is actually read together; in years where they are read
67
+ * separately, this returns `null`. Use {@link findContaining} to find the
68
+ * date a parsha is read regardless of whether it is doubled.
69
+ *
70
+ * Throws `RangeError` for an out-of-range numeric input or an invalid
71
+ * doubled-parsha pair, and `TypeError` for a malformed array argument.
72
+ * @example
73
+ * import {Sedra} from '@hebcal/core';
74
+ * const sedra = new Sedra(5784, false);
75
+ * sedra.find('Noach')?.toString(); // '15 Cheshvan 5784'
76
+ * sedra.find(1)?.toString(); // same, by 0-based index
77
+ * sedra.find('Matot-Masei')?.toString(); // null in 5784 — read separately
78
+ * sedra.find(['Matot', 'Masei']); // also null in 5784
48
79
  * @param parsha if a `string`, specified with Sephardic transliterations
49
80
  * like `'Noach'` or `'Matot-Masei'`. If an array, must be a 1- or 2-element
50
81
  * array such as `['Noach']` or `['Matot', 'Masei']`. If a `number`, should
@@ -54,22 +85,63 @@ export declare class Sedra {
54
85
  find(parsha: number | string | string[]): HDate | null;
55
86
  private findInternal;
56
87
  /**
57
- * Returns the date that a parsha (or its doubled or undoubled counterpart)
58
- * occurs, or `null` if the parsha doesn't occur this year
88
+ * Returns the date a parsha is read this year, looking through both
89
+ * single and doubled forms.
90
+ *
91
+ * For example, if `'Matot'` is read individually this year, this returns
92
+ * its date; if it is read as part of `'Matot-Masei'` this year, this
93
+ * returns the date of `'Matot-Masei'` (and similarly for `'Masei'`).
94
+ * Conversely, asking for `'Matot-Masei'` in a year where they are split
95
+ * will return the date of `'Matot'` alone.
96
+ * @example
97
+ * import {Sedra} from '@hebcal/core';
98
+ * const sedra = new Sedra(5784, false);
99
+ * // Matot-Masei is split in 5784; both individual halves resolve:
100
+ * sedra.findContaining('Matot')?.toString(); // '22 Tamuz 5784'
101
+ * sedra.findContaining('Masei')?.toString(); // '29 Tamuz 5784'
102
+ * // Asking for the doubled name returns the date of the first half:
103
+ * sedra.findContaining('Matot-Masei')?.toString(); // '22 Tamuz 5784'
59
104
  */
60
105
  findContaining(parsha: number | string): HDate | null;
61
106
  /**
62
- * Returns the underlying annual sedra schedule.
63
- * Used by `@hebcal/triennial`
107
+ * Returns the underlying annual reading schedule as an array, where each
108
+ * entry corresponds to one Saturday (starting from the first Shabbat on
109
+ * or after Rosh Hashana). Entries are either:
110
+ * - a non-negative `number`: a 0-based parsha index (e.g. `0` for
111
+ * *Bereshit*)
112
+ * - a negative `number`: the negated first index of a doubled parsha
113
+ * (e.g. `-21` for *Vayakhel-Pekudei*)
114
+ * - a `string`: a holiday name when a Yom Tov displaces the weekly reading
115
+ * (e.g. `'Pesach Shabbat Chol ha-Moed'`, `'Yom Kippur'`)
116
+ *
117
+ * Used by `@hebcal/triennial`.
64
118
  */
65
119
  getSedraArray(): readonly NumberOrString[];
66
120
  /**
67
- * R.D. date of the first Saturday on or after Rosh Hashana
121
+ * Returns the R.D. (Rata Die / Fixed Date) absolute day number of the
122
+ * first Saturday on or after Rosh Hashana of this year. This is the
123
+ * anchor point for {@link getSedraArray} — index `0` of that array
124
+ * corresponds to this date.
68
125
  */
69
126
  getFirstSaturday(): number;
127
+ /** Returns the Hebrew year this `Sedra` instance covers. */
70
128
  getYear(): number;
71
129
  /**
72
- * Returns an object describing the parsha on the first Saturday on or after `hd`
130
+ * Returns details about the parsha read on the first Saturday on or after
131
+ * `hd`. If `hd` is itself a Saturday, the reading for that date is
132
+ * returned; otherwise the reading for the upcoming Saturday is returned.
133
+ *
134
+ * If the given date falls in the final days of the Hebrew year (after
135
+ * the last reading of this year's schedule), this method transparently
136
+ * delegates to the next year's `Sedra`.
137
+ * @example
138
+ * import {Sedra, HDate, months} from '@hebcal/core';
139
+ * const sedra = new Sedra(5784, false);
140
+ * // A weekday — returns the upcoming Shabbat's reading
141
+ * const result = sedra.lookup(new HDate(13, months.CHESHVAN, 5784));
142
+ * console.log(result.parsha); // ['Lech-Lecha']
143
+ * console.log(result.chag); // false
144
+ * console.log(result.hdate.toString()); // '15 Cheshvan 5784' (Saturday)
73
145
  * @param hd Hebrew date or R.D. days
74
146
  */
75
147
  lookup(hd: HDate | number): SedraResult;
@@ -86,10 +158,18 @@ export declare class Sedra {
86
158
  export declare const parshiot: readonly string[];
87
159
  type NumberOrString = number | string;
88
160
  /**
89
- * Convenience function to create an instance of `Sedra` or reuse a previously
90
- * created and cached instance.
91
- * @param hyear
92
- * @param il
161
+ * Convenience function to create an instance of {@link Sedra} or reuse a
162
+ * previously created and cached instance for the same year and schedule.
163
+ *
164
+ * Prefer this over `new Sedra(...)` when calling repeatedly — an internal
165
+ * LRU cache (~120 entries) avoids recomputing the keviyah-specific schedule.
166
+ * @example
167
+ * import {getSedra, HDate, months} from '@hebcal/core';
168
+ * const sedra = getSedra(5784, false);
169
+ * const {parsha} = sedra.lookup(new HDate(15, months.CHESHVAN, 5784));
170
+ * console.log(parsha); // ['Lech-Lecha']
171
+ * @param hyear Hebrew year
172
+ * @param il Use Israel sedra schedule (`false` for Diaspora)
93
173
  */
94
174
  export declare function getSedra(hyear: number, il: boolean): Sedra;
95
175
  export {};