@hebcal/core 6.3.1 → 6.3.3

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 (52) hide show
  1. package/dist/bundle.js +77 -60
  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/DailyLearning.js +1 -1
  6. package/dist/esm/HebrewDateEvent.js +1 -1
  7. package/dist/esm/HolidayEvent.js +1 -1
  8. package/dist/esm/MevarchimChodeshEvent.js +1 -1
  9. package/dist/esm/ParshaEvent.js +1 -1
  10. package/dist/esm/TimedEvent.js +1 -1
  11. package/dist/esm/YomKippurKatanEvent.js +1 -1
  12. package/dist/esm/ashkenazi.po.js +1 -1
  13. package/dist/esm/calendar.js +37 -10
  14. package/dist/esm/calendar.js.map +1 -1
  15. package/dist/esm/candles.js +1 -1
  16. package/dist/esm/event.js +1 -1
  17. package/dist/esm/getStartAndEnd.js +1 -1
  18. package/dist/esm/hallel.js +1 -1
  19. package/dist/esm/he-x-NoNikud.po.js +1 -1
  20. package/dist/esm/he.po.js +1 -1
  21. package/dist/esm/hebcal.js +1 -1
  22. package/dist/esm/holidays.js +1 -1
  23. package/dist/esm/index.js +1 -1
  24. package/dist/esm/isAssurBemlacha.js +1 -1
  25. package/dist/esm/locale.js +1 -1
  26. package/dist/esm/location.js +1 -1
  27. package/dist/esm/modern.js +1 -1
  28. package/dist/esm/molad.js +4 -9
  29. package/dist/esm/molad.js.map +1 -1
  30. package/dist/esm/moladBase.js +1 -1
  31. package/dist/esm/moladDate.js +1 -1
  32. package/dist/esm/omer.js +6 -13
  33. package/dist/esm/omer.js.map +1 -1
  34. package/dist/esm/parshaName.js +4 -5
  35. package/dist/esm/parshaName.js.map +1 -1
  36. package/dist/esm/parshaYear.js +1 -1
  37. package/dist/esm/pkgVersion.d.ts +1 -1
  38. package/dist/esm/pkgVersion.js +2 -2
  39. package/dist/esm/pkgVersion.js.map +1 -1
  40. package/dist/esm/reformatTimeStr.js +1 -1
  41. package/dist/esm/sedra.js +1 -1
  42. package/dist/esm/sefira.json.js +1 -1
  43. package/dist/esm/staticHolidays.js +1 -1
  44. package/dist/esm/tachanun.js +1 -1
  45. package/dist/esm/zmanim.js +1 -1
  46. package/dist/src/calendar.js +36 -9
  47. package/dist/src/molad.js +3 -8
  48. package/dist/src/omer.js +4 -11
  49. package/dist/src/parshaName.js +3 -4
  50. package/dist/src/pkgVersion.d.ts +1 -1
  51. package/dist/src/pkgVersion.js +1 -1
  52. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"molad.js","sources":["../../../src/molad.ts"],"sourcesContent":["import 'temporal-polyfill/global';\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 === 'he' || locale === 'he-x-nonikud' || locale === 'h') {\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 locale = locale ?? 'en';\n if (typeof locale === 'string') {\n locale = locale.toLowerCase();\n }\n const isHebrewLocale =\n locale === 'he' || locale === 'he-x-nonikud' || locale === 'h';\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 (isHebrewLocale) {\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 === '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,OAA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AAK,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
+ {"version":3,"file":"molad.js","sources":["../../../src/molad.ts"],"sourcesContent":["import 'temporal-polyfill/global';\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;IAC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;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.3.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.3.3, 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.3.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.3.3, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import 'temporal-polyfill/global';
3
3
  import { getTimezoneOffset } from '@hebcal/hdate';
4
4
 
package/dist/esm/omer.js CHANGED
@@ -1,5 +1,5 @@
1
- /*! @hebcal/core v6.3.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
- import { gematriya, Locale } from '@hebcal/hdate';
1
+ /*! @hebcal/core v6.3.3, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
+ import { Locale, gematriya } from '@hebcal/hdate';
3
3
  import { Event, flags } from './event.js';
4
4
  import './locale.js';
5
5
  import sefira from './sefira.json.js';
@@ -235,11 +235,7 @@ class OmerEvent extends Event {
235
235
  * @param [locale] Optional locale name (defaults to empty locale)
236
236
  */
237
237
  render(locale) {
238
- locale = locale ?? 'en';
239
- if (typeof locale === 'string') {
240
- locale = locale.toLowerCase();
241
- }
242
- const isHebrewLocale = locale === 'he' || locale === 'he-x-nonikud' || locale === 'h';
238
+ const isHebrewLocale = Locale.isHebrewLocale(locale);
243
239
  const omer = this.omer;
244
240
  const nth = isHebrewLocale ? gematriya(omer) : Locale.ordinal(omer, locale);
245
241
  return nth + ' ' + Locale.gettext('day of the Omer', locale);
@@ -291,11 +287,8 @@ class OmerEvent extends Event {
291
287
  * or `הַיוֹם עֲשָׂרָה יָמִים, שְׁהֵם שָׁבוּעַ אֶחָד וְשְׁלוֹשָׁה יָמִים לָעוֹמֶר`
292
288
  */
293
289
  getTodayIs(locale) {
294
- locale = locale ?? 'en';
295
- if (typeof locale === 'string') {
296
- locale = locale.toLowerCase();
297
- }
298
- const isHebrew = locale === 'he' || locale === 'he-x-nonikud';
290
+ locale = (locale || 'en').toLowerCase();
291
+ const isHebrew = Locale.isHebrewLocale(locale);
299
292
  const str = isHebrew ? omerTodayIsHe(this.omer) : omerTodayIsEn(this.omer);
300
293
  if (locale === 'he-x-nonikud') {
301
294
  return Locale.hebrewStripNikkud(str);
@@ -304,7 +297,7 @@ class OmerEvent extends Event {
304
297
  }
305
298
  url() {
306
299
  const year = this.getDate().getFullYear();
307
- if (year <= 4000 || year > 6759) {
300
+ if (year < 5000 || year > 6759) {
308
301
  return undefined;
309
302
  }
310
303
  return `https://www.hebcal.com/omer/${year}/${this.omer}`;
@@ -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 locale = locale ?? 'en';\n if (typeof locale === 'string') {\n locale = locale.toLowerCase();\n }\n const isHebrewLocale =\n locale === 'he' || locale === 'he-x-nonikud' || locale === 'h';\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';\n if (typeof locale === 'string') {\n locale = locale.toLowerCase();\n }\n const isHebrew = locale === 'he' || locale === 'he-x-nonikud';\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 <= 4000 || 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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Ac,EAAA;AACvB,QAAA,MAAM,GAAG,MAAM,IAAI,IAAI;AACvB,QAAA,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;AAC9B,YAAA,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE;QAC/B;QACA,MAAM,QAAQ,GAAG,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,cAAc;QAC7D,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,IAAI,IAAI,IAAI,IAAI,GAAG,IAAI,EAAE;AAC/B,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/** 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,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enses/gpl-2.0.txt */
2
2
  import './locale.js';
3
3
  import { Locale } from '@hebcal/hdate';
4
4
 
5
5
  /** @private */
6
6
  function renderParshaName(parsha, locale) {
7
- const locale0 = locale ?? 'en';
8
- let name = Locale.gettext(parsha[0], locale0);
7
+ let name = Locale.gettext(parsha[0], locale);
9
8
  if (parsha.length === 2) {
10
- const hyphen = locale0 === 'he' ? '־' : '-';
11
- name += hyphen + Locale.gettext(parsha[1], locale0);
9
+ const hyphen = Locale.isHebrewLocale(locale) ? '־' : '-';
10
+ name += hyphen + Locale.gettext(parsha[1], locale);
12
11
  }
13
12
  name = name.replace(/'/g, '’');
14
13
  const str = Locale.gettext('Parashat', locale) + ' ' + name;
@@ -1 +1 @@
1
- {"version":3,"file":"parshaName.js","sources":["../../../src/parshaName.ts"],"sourcesContent":["import {Locale} from './locale';\n\n/** @private */\nexport function renderParshaName(parsha: string[], locale?: string): string {\n const locale0 = locale ?? 'en';\n let name = Locale.gettext(parsha[0], locale0);\n if (parsha.length === 2) {\n const hyphen = locale0 === 'he' ? '־' : '-';\n name += hyphen + Locale.gettext(parsha[1], locale0);\n }\n name = name.replace(/'/g, '’');\n const str = Locale.gettext('Parashat', locale) + ' ' + name;\n return str.normalize();\n}\n"],"names":[],"mappings":";;;;AAEA;AACM,SAAU,gBAAgB,CAAC,MAAgB,EAAE,MAAe,EAAA;AAChE,IAAA,MAAM,OAAO,GAAG,MAAM,IAAI,IAAI;AAC9B,IAAA,IAAI,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC;AAC7C,IAAA,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;AACvB,QAAA,MAAM,MAAM,GAAG,OAAO,KAAK,IAAI,GAAG,GAAG,GAAG,GAAG;AAC3C,QAAA,IAAI,IAAI,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC;IACrD;IACA,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;AAC9B,IAAA,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,GAAG,GAAG,IAAI;AAC3D,IAAA,OAAO,GAAG,CAAC,SAAS,EAAE;AACxB;;;;"}
1
+ {"version":3,"file":"parshaName.js","sources":["../../../src/parshaName.ts"],"sourcesContent":["import {Locale} from './locale';\n\n/** @private */\nexport function renderParshaName(parsha: string[], locale?: string): string {\n let name = Locale.gettext(parsha[0], locale);\n if (parsha.length === 2) {\n const hyphen = Locale.isHebrewLocale(locale) ? '־' : '-';\n name += hyphen + Locale.gettext(parsha[1], locale);\n }\n name = name.replace(/'/g, '’');\n const str = Locale.gettext('Parashat', locale) + ' ' + name;\n return str.normalize();\n}\n"],"names":[],"mappings":";;;;AAEA;AACM,SAAU,gBAAgB,CAAC,MAAgB,EAAE,MAAe,EAAA;AAChE,IAAA,IAAI,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC;AAC5C,IAAA,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;AACvB,QAAA,MAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,GAAG,GAAG,GAAG;AACxD,QAAA,IAAI,IAAI,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC;IACpD;IACA,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;AAC9B,IAAA,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,GAAG,GAAG,IAAI;AAC3D,IAAA,OAAO,GAAG,CAAC,SAAS,EAAE;AACxB;;;;"}
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.3.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.3.3, 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';
@@ -1,2 +1,2 @@
1
1
  /** DO NOT EDIT THIS AUTO-GENERATED FILE! */
2
- export declare const version = "6.3.1";
2
+ export declare const version = "6.3.3";
@@ -1,6 +1,6 @@
1
- /*! @hebcal/core v6.3.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.3.3, 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.3.1';
3
+ const version = '6.3.3';
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.3.1';\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.3.3';\n"],"names":[],"mappings":";AAAA;AACO,MAAM,OAAO,GAAG;;;;"}
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.3.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.3.3, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  const hour12cc = {
3
3
  US: 1,
4
4
  CA: 1,
package/dist/esm/sedra.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.3.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.3.3, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { HDate, months } from '@hebcal/hdate';
3
3
  import QuickLRU from 'quick-lru';
4
4
  import './locale.js';
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.3.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.3.3, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  const ps67lines=["אֱלֹהִים יְחָנֵּנוּ וִיבָרְכֵנוּ יָאֵר־פָּנָיו אִתָּנוּ סֶלָה","לָדַעַת בָּאָרֶץ דַּרְכֶּךָ בְּכָל־גּוֹיִם יְשׁוּעָתֶךָ","יוֹדוּךָ עַמִּים אֱלֹהִים יוֹדוּךָ עַמִּים כֻּלָּם","יִשְׂמְחוּ וִירַנְּנוּ לְאֻמִּים כִּי־תִשְׁפֹּט עַמִּים מִישׁוֹר וּלְאֻמִּים בָּאָרֶץ תַּנחֵם סֶלָה","יוֹדוּךָ עַמִּים אֱלֹהִים יוֹדוּךָ עַמִּים כֻּלָּם","אֶרֶץ נָתְנָה יְבוּלָהּ יְבָרְכֵנוּ אֱלֹהִים אֱלֹהֵינוּ","יְבָרְכֵנוּ אֱלֹהִים וְיִירְאוּ אוֹתוֹ כָּל־אַפְסֵי־אָרֶץ"];const lamnatzeachLetters="ישמחווירננולאמיםכיתשפוטעמיםמישורולאמיםבארץתנחםסלה";const anaBekoach=["אָנָּא","בְּכֹחַ","גְּדֻלַּת","יְמִינְךָ","תַּתִּיר","צְרוּרָה","אב״ג ית״ץ","קַבֵּל","רִנַּת","עַמְּךָ","שַׂגְּבֵנוּ","טַהֲרֵנוּ","נוֹרָא","קר״ע שט״ן","נָא","גִבּוֹר","דּוֹרְשֵׁי","יִחוּדְךָ","כְּבָבַת","שָׁמְרֵם","נג״ד יכ״ש","בָּרְכֵם","טַהֲרֵם","רַחֲמֵי","צִדְקָתְךָ","תָּמִיד","גָּמְלֵם","בט״ר צת״ג","חֲסִין","קָדוֹשׁ","בְּרֹב","טוּבְךָ","נַהֵל","עֲדָתֶךָ","חק״ב תנ״ע","יָחִיד","גֵּאֶה","לְעַמְּךָ","פְּנֵה","זוֹכְרֵי","קְדֻשָּׁתֶךָ","יג״ל פז״ק","שַׁוְעָתֵנוּ","קַבֵּל","וּשְׁמַע","צַעֲקָתֵנוּ","יוֹדֵעַ","תַּעֲלוּמוֹת","שק״ו צי״ת"];var sefira = {ps67lines:ps67lines,lamnatzeachLetters:lamnatzeachLetters,anaBekoach:anaBekoach};
3
3
 
4
4
  export { anaBekoach, sefira as default, lamnatzeachLetters, ps67lines };
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.3.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.3.3, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { months } from '@hebcal/hdate';
3
3
  import { flags } from './event.js';
4
4
 
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.3.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.3.3, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { HDate, months } from '@hebcal/hdate';
3
3
  import { dateYomHaZikaron } from './modern.js';
4
4
 
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.3.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.3.3, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import 'temporal-polyfill/global';
3
3
  import { NOAACalculator } from '@hebcal/noaa';
4
4
  import { HDate, isDate, getTimezoneOffset, pad2, getPseudoISO } from '@hebcal/hdate';
@@ -186,6 +186,18 @@ export function calendar(options = {}) {
186
186
  for (const ev of holidays) {
187
187
  candlesEv = appendHolidayAndRelated(candlesEv, evts, ev, options, isFriday, isSaturday, hasUserMask);
188
188
  }
189
+ const mm = hd.getMonth();
190
+ const dd = hd.getDate();
191
+ // When Erev Pesach falls on Shabbat, burning chametz is moved to Friday.
192
+ if (isFriday &&
193
+ options.candlelighting &&
194
+ mm === months.NISAN &&
195
+ dd === 13) {
196
+ const biurEv = makeBiurChametzEvent(hd, options);
197
+ if (biurEv) {
198
+ evts.push(biurEv);
199
+ }
200
+ }
189
201
  if (options.sedrot && isSaturday) {
190
202
  const parsha0 = sedra.lookup(abs);
191
203
  if (!parsha0.chag) {
@@ -193,8 +205,6 @@ export function calendar(options = {}) {
193
205
  }
194
206
  }
195
207
  if (options.yizkor) {
196
- const mm = hd.getMonth();
197
- const dd = hd.getDate();
198
208
  if ((mm === months.TISHREI && (dd === 10 || dd === 22)) ||
199
209
  (mm === NISAN && dd === (il ? 21 : 22)) ||
200
210
  (mm === SIVAN && dd === (il ? 6 : 7))) {
@@ -566,7 +576,7 @@ function appendHolidayAndRelated(candlesEv, events, ev, options, isFriday, isSat
566
576
  (options.noModern && eFlags & MODERN_HOLIDAY)) {
567
577
  return candlesEv; // bail out early
568
578
  }
569
- if (options.candlelighting && ev.getDesc() === 'Erev Pesach') {
579
+ if (options.candlelighting && ev.getDesc() === hdesc.EREV_PESACH) {
570
580
  const evts = makeErevPesachChametzEvents(ev, options);
571
581
  if (evts.length) {
572
582
  events.push(...evts);
@@ -577,7 +587,7 @@ function appendHolidayAndRelated(candlesEv, events, ev, options, isFriday, isSat
577
587
  let fastEv;
578
588
  if (options.candlelighting &&
579
589
  (isMajorFast || isMinorFast) &&
580
- ev.getDesc() !== 'Yom Kippur') {
590
+ ev.getDesc() !== hdesc.YOM_KIPPUR) {
581
591
  ev = fastEv = makeFastStartEnd(ev, options);
582
592
  if (fastEv.startEvent &&
583
593
  (isMajorFast || (isMinorFast && !options.noMinorFast))) {
@@ -626,7 +636,7 @@ function makeMoladAndMevarchimChodesh(hd, options) {
626
636
  if (options.shabbatMevarchim) {
627
637
  const nextMonthName = HDate.getMonthName(monNext, hyear);
628
638
  const molad = new Molad(hyear, monNext);
629
- const memo = molad.render(options.locale || 'en', options);
639
+ const memo = molad.render(options.locale, options);
630
640
  evts.push(new MevarchimChodeshEvent(hd, nextMonthName, memo, options.locale));
631
641
  }
632
642
  }
@@ -670,15 +680,32 @@ function makeErevPesachChametzEvents(erevPesachEv, options) {
670
680
  const hd = erevPesachEv.getDate();
671
681
  const zmanim = new Zmanim(location, hd, useElevation);
672
682
  const zmanAchilas = zmanim.sofZmanTfilla(); // Gra
673
- const time = zmanim.sofZmanBiurChametzGRA();
674
- if (isNaN(zmanAchilas.getTime()) || isNaN(time.getTime())) {
683
+ if (isNaN(zmanAchilas.getTime())) {
675
684
  return [];
676
685
  }
677
686
  const zmanAchilasEv = new TimedEvent(hd, hdesc.SOF_ZMAN_ACHILAT_CHAMETZ, 0, zmanAchilas, location, undefined, options);
678
687
  zmanAchilasEv.emoji = '🍞';
679
688
  evts.push(zmanAchilasEv);
689
+ // When Erev Pesach falls on Shabbat, chametz cannot be burned on Shabbat,
690
+ // so Biur Chametz is emitted on the Friday before (see makeBiurChametzEvent
691
+ // called from the main calendar loop). Skip it here in that case.
692
+ if (hd.getDay() !== SAT) {
693
+ const biurEv = makeBiurChametzEvent(hd, options);
694
+ if (biurEv) {
695
+ evts.push(biurEv);
696
+ }
697
+ }
698
+ return evts;
699
+ }
700
+ function makeBiurChametzEvent(hd, options) {
701
+ const location = options.location;
702
+ const useElevation = Boolean(options.useElevation);
703
+ const zmanim = new Zmanim(location, hd, useElevation);
704
+ const time = zmanim.sofZmanBiurChametzGRA();
705
+ if (isNaN(time.getTime())) {
706
+ return undefined;
707
+ }
680
708
  const biurChametzEv = new TimedEvent(hd, hdesc.BIUR_CHAMETZ, 0, time, location, undefined, options);
681
709
  biurChametzEv.emoji = '🔥';
682
- evts.push(biurChametzEv);
683
- return evts;
710
+ return biurChametzEv;
684
711
  }
package/dist/src/molad.js CHANGED
@@ -34,7 +34,7 @@ const frDoW = [
34
34
  ];
35
35
  const night = 'בַּלַּ֥יְלָה';
36
36
  function getDayNames(locale) {
37
- if (locale === 'he' || locale === 'he-x-nonikud' || locale === 'h') {
37
+ if (Locale.isHebrewLocale(locale)) {
38
38
  return heDayNames;
39
39
  }
40
40
  else if (locale === 'fr') {
@@ -207,11 +207,6 @@ export class Molad {
207
207
  * @param options
208
208
  */
209
209
  render(locale, options) {
210
- locale = locale ?? 'en';
211
- if (typeof locale === 'string') {
212
- locale = locale.toLowerCase();
213
- }
214
- const isHebrewLocale = locale === 'he' || locale === 'he-x-nonikud' || locale === 'h';
215
210
  const monthName = Locale.gettext(this.getMonthName(), locale);
216
211
  const dayNames = getDayNames(locale);
217
212
  const dow = dayNames[this.getDow()];
@@ -222,7 +217,7 @@ export class Molad {
222
217
  const minutesStr = Locale.lookupTranslation('min', locale) ?? 'minutes';
223
218
  const chalakimStr = Locale.gettext('chalakim', locale);
224
219
  const and = Locale.gettext('and', locale);
225
- if (isHebrewLocale) {
220
+ if (Locale.isHebrewLocale(locale)) {
226
221
  const ampm = getHebrewTimeOfDay(hour);
227
222
  let result = `${moladStr} ${monthName} יִהְיֶה בַּיּוֹם ${dow} בשָׁבוּעַ, ` +
228
223
  `בְּשָׁעָה ${hour} ${ampm}, ` +
@@ -230,7 +225,7 @@ export class Molad {
230
225
  if (chalakim !== 0) {
231
226
  result += ` ו-${chalakim} ${chalakimStr}`;
232
227
  }
233
- if (locale === 'he-x-nonikud') {
228
+ if (locale.toLocaleLowerCase() === 'he-x-nonikud') {
234
229
  return Locale.hebrewStripNikkud(result);
235
230
  }
236
231
  return result;
package/dist/src/omer.js CHANGED
@@ -233,11 +233,7 @@ export class OmerEvent extends Event {
233
233
  * @param [locale] Optional locale name (defaults to empty locale)
234
234
  */
235
235
  render(locale) {
236
- locale = locale ?? 'en';
237
- if (typeof locale === 'string') {
238
- locale = locale.toLowerCase();
239
- }
240
- const isHebrewLocale = locale === 'he' || locale === 'he-x-nonikud' || locale === 'h';
236
+ const isHebrewLocale = Locale.isHebrewLocale(locale);
241
237
  const omer = this.omer;
242
238
  const nth = isHebrewLocale ? gematriya(omer) : Locale.ordinal(omer, locale);
243
239
  return nth + ' ' + Locale.gettext('day of the Omer', locale);
@@ -289,11 +285,8 @@ export class OmerEvent extends Event {
289
285
  * or `הַיוֹם עֲשָׂרָה יָמִים, שְׁהֵם שָׁבוּעַ אֶחָד וְשְׁלוֹשָׁה יָמִים לָעוֹמֶר`
290
286
  */
291
287
  getTodayIs(locale) {
292
- locale = locale ?? 'en';
293
- if (typeof locale === 'string') {
294
- locale = locale.toLowerCase();
295
- }
296
- const isHebrew = locale === 'he' || locale === 'he-x-nonikud';
288
+ locale = (locale || 'en').toLowerCase();
289
+ const isHebrew = Locale.isHebrewLocale(locale);
297
290
  const str = isHebrew ? omerTodayIsHe(this.omer) : omerTodayIsEn(this.omer);
298
291
  if (locale === 'he-x-nonikud') {
299
292
  return Locale.hebrewStripNikkud(str);
@@ -302,7 +295,7 @@ export class OmerEvent extends Event {
302
295
  }
303
296
  url() {
304
297
  const year = this.getDate().getFullYear();
305
- if (year <= 4000 || year > 6759) {
298
+ if (year < 5000 || year > 6759) {
306
299
  return undefined;
307
300
  }
308
301
  return `https://www.hebcal.com/omer/${year}/${this.omer}`;
@@ -1,11 +1,10 @@
1
1
  import { Locale } from './locale';
2
2
  /** @private */
3
3
  export function renderParshaName(parsha, locale) {
4
- const locale0 = locale ?? 'en';
5
- let name = Locale.gettext(parsha[0], locale0);
4
+ let name = Locale.gettext(parsha[0], locale);
6
5
  if (parsha.length === 2) {
7
- const hyphen = locale0 === 'he' ? '־' : '-';
8
- name += hyphen + Locale.gettext(parsha[1], locale0);
6
+ const hyphen = Locale.isHebrewLocale(locale) ? '־' : '-';
7
+ name += hyphen + Locale.gettext(parsha[1], locale);
9
8
  }
10
9
  name = name.replace(/'/g, '’');
11
10
  const str = Locale.gettext('Parashat', locale) + ' ' + name;
@@ -1,2 +1,2 @@
1
1
  /** DO NOT EDIT THIS AUTO-GENERATED FILE! */
2
- export declare const version = "6.3.1";
2
+ export declare const version = "6.3.3";
@@ -1,2 +1,2 @@
1
1
  /** DO NOT EDIT THIS AUTO-GENERATED FILE! */
2
- export const version = '6.3.1';
2
+ export const version = '6.3.3';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/core",
3
- "version": "6.3.1",
3
+ "version": "6.3.3",
4
4
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
5
5
  "contributors": [
6
6
  "Eyal Schachter (https://github.com/Scimonster)",
@@ -73,7 +73,7 @@
73
73
  "@rollup/plugin-terser": "^1.0.0",
74
74
  "@rollup/plugin-typescript": "^12.3.0",
75
75
  "@types/node": "^25.6.0",
76
- "@vitest/coverage-v8": "^4.1.4",
76
+ "@vitest/coverage-v8": "^4.1.5",
77
77
  "gettext-parser": "^9.0.2",
78
78
  "gts": "^7.0.0",
79
79
  "pretty-bytes": "^7.1.0",
@@ -82,10 +82,10 @@
82
82
  "rollup-plugin-visualizer": "^7.0.1",
83
83
  "typedoc": "^0.28.19",
84
84
  "typescript": "^6.0.3",
85
- "vitest": "^4.1.4"
85
+ "vitest": "^4.1.5"
86
86
  },
87
87
  "dependencies": {
88
- "@hebcal/hdate": "^0.22.0",
88
+ "@hebcal/hdate": "^0.22.1",
89
89
  "@hebcal/noaa": "^0.10.1",
90
90
  "quick-lru": "^7.3.0",
91
91
  "temporal-polyfill": "^0.3.2"