@hebcal/core 6.8.2 → 6.9.0

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 (95) hide show
  1. package/README.md +262 -4
  2. package/dist/bundle.js +1400 -942
  3. package/dist/bundle.js.map +1 -1
  4. package/dist/bundle.min.js +18 -17
  5. package/dist/bundle.min.js.map +1 -1
  6. package/dist/esm/CalOptions.d.ts +11 -1
  7. package/dist/esm/DailyLearning.d.ts +4 -4
  8. package/dist/esm/DailyLearning.js +5 -5
  9. package/dist/esm/DailyLearning.js.map +1 -1
  10. package/dist/esm/HebrewDateEvent.js +1 -1
  11. package/dist/esm/HolidayEvent.d.ts +7 -2
  12. package/dist/esm/HolidayEvent.js +8 -3
  13. package/dist/esm/HolidayEvent.js.map +1 -1
  14. package/dist/esm/MevarchimChodeshEvent.d.ts +2 -1
  15. package/dist/esm/MevarchimChodeshEvent.js +3 -2
  16. package/dist/esm/MevarchimChodeshEvent.js.map +1 -1
  17. package/dist/esm/ParshaEvent.d.ts +13 -0
  18. package/dist/esm/ParshaEvent.js +14 -1
  19. package/dist/esm/ParshaEvent.js.map +1 -1
  20. package/dist/esm/TimedEvent.d.ts +12 -4
  21. package/dist/esm/TimedEvent.js +13 -5
  22. package/dist/esm/TimedEvent.js.map +1 -1
  23. package/dist/esm/YomKippurKatanEvent.d.ts +2 -1
  24. package/dist/esm/YomKippurKatanEvent.js +3 -2
  25. package/dist/esm/YomKippurKatanEvent.js.map +1 -1
  26. package/dist/esm/ashkenazi.po.js +1 -1
  27. package/dist/esm/calendar.d.ts +17 -7
  28. package/dist/esm/calendar.js +23 -10
  29. package/dist/esm/calendar.js.map +1 -1
  30. package/dist/esm/candles.d.ts +19 -1
  31. package/dist/esm/candles.js +20 -2
  32. package/dist/esm/candles.js.map +1 -1
  33. package/dist/esm/cities.json.js +1 -1
  34. package/dist/esm/event.d.ts +2 -4
  35. package/dist/esm/event.js +3 -5
  36. package/dist/esm/event.js.map +1 -1
  37. package/dist/esm/getStartAndEnd.js +1 -1
  38. package/dist/esm/hallel.js +1 -1
  39. package/dist/esm/he-x-NoNikud.po.js +1 -1
  40. package/dist/esm/he.po.js +1 -1
  41. package/dist/esm/hebcal.d.ts +31 -96
  42. package/dist/esm/hebcal.js +34 -107
  43. package/dist/esm/hebcal.js.map +1 -1
  44. package/dist/esm/holidays.d.ts +8 -1
  45. package/dist/esm/holidays.js +2 -2
  46. package/dist/esm/holidays.js.map +1 -1
  47. package/dist/esm/index.d.ts +3 -1
  48. package/dist/esm/index.js +3 -1
  49. package/dist/esm/index.js.map +1 -1
  50. package/dist/esm/isAssurBemlacha.js +6 -3
  51. package/dist/esm/isAssurBemlacha.js.map +1 -1
  52. package/dist/esm/isAveilut.js +1 -1
  53. package/dist/esm/isFastDay.d.ts +1 -1
  54. package/dist/esm/isFastDay.js +2 -2
  55. package/dist/esm/isFastDay.js.map +1 -1
  56. package/dist/esm/locale.js +1 -1
  57. package/dist/esm/location.d.ts +37 -9
  58. package/dist/esm/location.js +38 -10
  59. package/dist/esm/location.js.map +1 -1
  60. package/dist/esm/modern.js +1 -1
  61. package/dist/esm/molad.d.ts +26 -20
  62. package/dist/esm/molad.js +27 -21
  63. package/dist/esm/molad.js.map +1 -1
  64. package/dist/esm/moladBase.d.ts +11 -0
  65. package/dist/esm/moladBase.js +12 -1
  66. package/dist/esm/moladBase.js.map +1 -1
  67. package/dist/esm/moladDate.d.ts +10 -6
  68. package/dist/esm/moladDate.js +25 -18
  69. package/dist/esm/moladDate.js.map +1 -1
  70. package/dist/esm/omer.d.ts +19 -3
  71. package/dist/esm/omer.js +20 -4
  72. package/dist/esm/omer.js.map +1 -1
  73. package/dist/esm/parshaName.js +1 -1
  74. package/dist/esm/parshaYear.d.ts +2 -2
  75. package/dist/esm/parshaYear.js +3 -3
  76. package/dist/esm/parshaYear.js.map +1 -1
  77. package/dist/esm/pkgVersion.d.ts +1 -1
  78. package/dist/esm/pkgVersion.js +2 -2
  79. package/dist/esm/pkgVersion.js.map +1 -1
  80. package/dist/esm/reformatTimeStr.d.ts +14 -2
  81. package/dist/esm/reformatTimeStr.js +15 -3
  82. package/dist/esm/reformatTimeStr.js.map +1 -1
  83. package/dist/esm/sedra.d.ts +44 -18
  84. package/dist/esm/sedra.js +39 -17
  85. package/dist/esm/sedra.js.map +1 -1
  86. package/dist/esm/sefira.json.js +1 -1
  87. package/dist/esm/staticHolidays.d.ts +0 -2
  88. package/dist/esm/staticHolidays.js +1 -3
  89. package/dist/esm/staticHolidays.js.map +1 -1
  90. package/dist/esm/string.js +1 -1
  91. package/dist/esm/tachanun.js +1 -1
  92. package/dist/esm/zmanim.d.ts +177 -142
  93. package/dist/esm/zmanim.js +183 -148
  94. package/dist/esm/zmanim.js.map +1 -1
  95. package/package.json +8 -9
@@ -1,24 +1,27 @@
1
- /*! @hebcal/core v6.8.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.9.0, 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
 
5
5
  /** constant for milliseconds in a minute (60,000) */
6
6
  const MINUTE_MILLIS = 60 * 1000;
7
7
  /**
8
- * A method that will return the location's local mean time offset in milliseconds from local <a
9
- * href="https://en.wikipedia.org/wiki/Standard_time">standard time</a>. The globe is split into 360&deg;, with
10
- * 15&deg; per hour of the day. For a local that is at a longitude that is evenly divisible by 15 (longitude % 15 ==
11
- * 0), at solar {@link com.kosherjava.zmanim.AstronomicalCalendar#getSunTransit() noon} (with adjustment for the <a
12
- * href="https://en.wikipedia.org/wiki/Equation_of_time">equation of time</a>) the sun should be directly overhead,
13
- * so a user who is 1&deg; west of this will have noon at 4 minutes after standard time noon, and conversely, a user
14
- * who is 1&deg; east of the 15&deg; longitude will have noon at 11:56 AM. Lakewood, N.J., whose longitude is
15
- * -74.222, is 0.778 away from the closest multiple of 15 at -75&deg;. This is multiplied by 4 to yield 3 minutes
16
- * and 10 seconds earlier than standard time. The offset returned does not account for the <a
17
- * href="https://en.wikipedia.org/wiki/Daylight_saving_time">Daylight saving time</a> offset since this class is
8
+ * A method that will return the location's local mean time offset in milliseconds from local
9
+ * [standard time](https://en.wikipedia.org/wiki/Standard_time). The globe is split into 360°, with
10
+ * 15° per hour of the day. For a locale that is at a longitude that is evenly divisible by 15
11
+ * (longitude % 15 == 0), at solar noon (with adjustment for the
12
+ * [equation of time](https://en.wikipedia.org/wiki/Equation_of_time)) the sun should be directly overhead,
13
+ * so a user who is 1° west of this will have noon at 4 minutes after standard time noon, and conversely, a user
14
+ * who is 1° east of the 15° longitude will have noon at 11:56 AM. Lakewood, N.J., whose longitude is
15
+ * -74.222, is 0.778 away from the closest multiple of 15 at -75°. This is multiplied by 4 to yield 3 minutes
16
+ * and 10 seconds earlier than standard time. The offset returned does not account for the
17
+ * [Daylight saving time](https://en.wikipedia.org/wiki/Daylight_saving_time) offset since this function is
18
18
  * unaware of dates.
19
19
  *
20
+ * @param dt the date used to resolve the timezone offset
21
+ * @param longitude the location's longitude
22
+ * @param tzid IANA timezone identifier
20
23
  * @return the offset in milliseconds not accounting for Daylight saving time. A positive value will be returned
21
- * East of the 15&deg; timezone line, and a negative value West of it.
24
+ * East of the 15° timezone line, and a negative value West of it.
22
25
  */
23
26
  function getLocalMeanTimeOffset(dt, longitude, tzid) {
24
27
  const offset = -1 * getTimezoneOffset(tzid, dt);
@@ -26,13 +29,17 @@ function getLocalMeanTimeOffset(dt, longitude, tzid) {
26
29
  return Math.trunc(d);
27
30
  }
28
31
  /**
29
- * Returns the molad in UTC as a Temporal.ZonedDateTime.
30
- * This method subtracts 20.94 minutes (20 minutes and 56.496 seconds) from the computed time (Har Habayis with a longitude
31
- * of 35.2354&deg; is 5.2354&deg; away from the %15 timezone longitude) to get to standard time. This method
32
- * intentionally uses standard time and not daylight savings time.
32
+ * Returns the moment of the molad as a `Temporal.ZonedDateTime` in the `UTC` zone.
33
33
  *
34
- * @return the ZonedDateTime representing the moment of the molad in UTC
35
-
34
+ * The molad is computed in Jerusalem *standard* time and then converted, so the
35
+ * returned instant is correct year-round; only the zone of the returned object
36
+ * is `UTC`. This method subtracts 20.94 minutes (20 minutes and 56.496 seconds)
37
+ * from the computed time — Har Habayis, at longitude 35.2354°, is 5.2354° away
38
+ * from the multiple-of-15 timezone longitude — to get to standard time. Daylight
39
+ * savings time is intentionally not applied; adjust when formatting for display.
40
+ *
41
+ * @param molad the molad to convert
42
+ * @return the `Temporal.ZonedDateTime` representing the moment of the molad
36
43
  */
37
44
  function getMoladAsDate(molad) {
38
45
  const moladSeconds = (molad.chalakim * 10) / 3;
@@ -1 +1 @@
1
- {"version":3,"file":"moladDate.js","sources":["../../../src/moladDate.ts"],"sourcesContent":["import 'temporal-polyfill/global';\nimport {getTimezoneOffset} from '@hebcal/hdate';\nimport {MoladBase} from './moladBase';\n\n/** constant for milliseconds in a minute (60,000) */\nconst MINUTE_MILLIS: number = 60 * 1000;\n\n/**\n * A method that will return the location's local mean time offset in milliseconds from local <a\n * href=\"https://en.wikipedia.org/wiki/Standard_time\">standard time</a>. The globe is split into 360&deg;, with\n * 15&deg; per hour of the day. For a local that is at a longitude that is evenly divisible by 15 (longitude % 15 ==\n * 0), at solar {@link com.kosherjava.zmanim.AstronomicalCalendar#getSunTransit() noon} (with adjustment for the <a\n * href=\"https://en.wikipedia.org/wiki/Equation_of_time\">equation of time</a>) the sun should be directly overhead,\n * so a user who is 1&deg; west of this will have noon at 4 minutes after standard time noon, and conversely, a user\n * who is 1&deg; east of the 15&deg; longitude will have noon at 11:56 AM. Lakewood, N.J., whose longitude is\n * -74.222, is 0.778 away from the closest multiple of 15 at -75&deg;. This is multiplied by 4 to yield 3 minutes\n * and 10 seconds earlier than standard time. The offset returned does not account for the <a\n * href=\"https://en.wikipedia.org/wiki/Daylight_saving_time\">Daylight saving time</a> offset since this class is\n * unaware of dates.\n *\n * @return the offset in milliseconds not accounting for Daylight saving time. A positive value will be returned\n * East of the 15&deg; timezone line, and a negative value West of it.\n */\nfunction getLocalMeanTimeOffset(dt: Date, longitude: number, tzid: string): number {\n const offset: number = -1 * getTimezoneOffset(tzid, dt);\n const d = longitude * 4 * MINUTE_MILLIS - offset * MINUTE_MILLIS;\n return Math.trunc(d);\n}\n\n/**\n * Returns the molad in UTC 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 ZonedDateTime representing the moment of the molad in UTC\n\n */\nexport function getMoladAsDate(molad: MoladBase): Temporal.ZonedDateTime {\n const moladSeconds: number = (molad.chalakim * 10) / 3;\n const millis: number = Math.trunc(\n 1000 * (moladSeconds - Math.trunc(moladSeconds))\n );\n\n const dt = molad.hdate.greg();\n\n // The raw molad Date (point in time) must be generated using standard time. Using \"Asia/Jerusalem\" timezone will result in the time\n // being incorrectly off by an hour in the summer due to DST. Proper adjustment for the actual time in DST will be done by the date\n // formatter class used to display the Date.\n const tzid: string = 'Etc/GMT+2';\n const zdt = Temporal.ZonedDateTime.from({\n year: dt.getFullYear(),\n month: dt.getMonth() + 1,\n day: dt.getDate(),\n hour: molad.hour,\n minute: molad.minutes,\n second: Math.trunc(moladSeconds),\n millisecond: millis,\n timeZone: tzid,\n });\n\n const longitude: number = 35.2354; // Har Habayis longitude\n const offset = getLocalMeanTimeOffset(dt, longitude, tzid);\n // subtract local time difference of 20.94 minutes (20 minutes and 56.496 seconds) to get to Standard time\n const zdt2 = zdt.subtract({milliseconds: offset});\n return zdt2.withTimeZone('UTC');\n}\n"],"names":[],"mappings":";;;;AAIA;AACA,MAAM,aAAa,GAAW,EAAE,GAAG,IAAI;AAEvC;;;;;;;;;;;;;;;AAeG;AACH,SAAS,sBAAsB,CAAC,EAAQ,EAAE,SAAiB,EAAE,IAAY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AAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;AACjC;;;;"}
1
+ {"version":3,"file":"moladDate.js","sources":["../../../src/moladDate.ts"],"sourcesContent":["import 'temporal-polyfill/global';\nimport {getTimezoneOffset} from '@hebcal/hdate';\nimport {MoladBase} from './moladBase';\n\n/** constant for milliseconds in a minute (60,000) */\nconst MINUTE_MILLIS: number = 60 * 1000;\n\n/**\n * A method that will return the location's local mean time offset in milliseconds from local\n * [standard time](https://en.wikipedia.org/wiki/Standard_time). The globe is split into 360°, with\n * 15° per hour of the day. For a locale that is at a longitude that is evenly divisible by 15\n * (longitude % 15 == 0), at solar noon (with adjustment for the\n * [equation of time](https://en.wikipedia.org/wiki/Equation_of_time)) the sun should be directly overhead,\n * so a user who is 1° west of this will have noon at 4 minutes after standard time noon, and conversely, a user\n * who is 1° east of the 15° longitude will have noon at 11:56 AM. Lakewood, N.J., whose longitude is\n * -74.222, is 0.778 away from the closest multiple of 15 at -75°. This is multiplied by 4 to yield 3 minutes\n * and 10 seconds earlier than standard time. The offset returned does not account for the\n * [Daylight saving time](https://en.wikipedia.org/wiki/Daylight_saving_time) offset since this function is\n * unaware of dates.\n *\n * @param dt the date used to resolve the timezone offset\n * @param longitude the location's longitude\n * @param tzid IANA timezone identifier\n * @return the offset in milliseconds not accounting for Daylight saving time. A positive value will be returned\n * East of the 15° timezone line, and a negative value West of it.\n */\nfunction getLocalMeanTimeOffset(dt: Date, longitude: number, tzid: string): number {\n const offset: number = -1 * getTimezoneOffset(tzid, dt);\n const d = longitude * 4 * MINUTE_MILLIS - offset * MINUTE_MILLIS;\n return Math.trunc(d);\n}\n\n/**\n * Returns the moment of the molad as a `Temporal.ZonedDateTime` in the `UTC` zone.\n *\n * The molad is computed in Jerusalem *standard* time and then converted, so the\n * returned instant is correct year-round; only the zone of the returned object\n * is `UTC`. This method subtracts 20.94 minutes (20 minutes and 56.496 seconds)\n * from the computed time — Har Habayis, at longitude 35.2354°, is 5.2354° away\n * from the multiple-of-15 timezone longitude — to get to standard time. Daylight\n * savings time is intentionally not applied; adjust when formatting for display.\n *\n * @param molad the molad to convert\n * @return the `Temporal.ZonedDateTime` representing the moment of the molad\n */\nexport function getMoladAsDate(molad: MoladBase): Temporal.ZonedDateTime {\n const moladSeconds: number = (molad.chalakim * 10) / 3;\n const millis: number = Math.trunc(\n 1000 * (moladSeconds - Math.trunc(moladSeconds))\n );\n\n const dt = molad.hdate.greg();\n\n // The raw molad Date (point in time) must be generated using standard time. Using \"Asia/Jerusalem\" timezone will result in the time\n // being incorrectly off by an hour in the summer due to DST. Proper adjustment for the actual time in DST will be done by the date\n // formatter class used to display the Date.\n const tzid: string = 'Etc/GMT+2';\n const zdt = Temporal.ZonedDateTime.from({\n year: dt.getFullYear(),\n month: dt.getMonth() + 1,\n day: dt.getDate(),\n hour: molad.hour,\n minute: molad.minutes,\n second: Math.trunc(moladSeconds),\n millisecond: millis,\n timeZone: tzid,\n });\n\n const longitude: number = 35.2354; // Har Habayis longitude\n const offset = getLocalMeanTimeOffset(dt, longitude, tzid);\n // subtract local time difference of 20.94 minutes (20 minutes and 56.496 seconds) to get to Standard time\n const zdt2 = zdt.subtract({milliseconds: offset});\n return zdt2.withTimeZone('UTC');\n}\n"],"names":[],"mappings":";;;;AAIA;AACA,MAAM,aAAa,GAAW,EAAE,GAAG,IAAI;AAEvC;;;;;;;;;;;;;;;;;;AAkBG;AACH,SAAS,sBAAsB,CAAC,EAAQ,EAAE,SAAiB,EAAE,IAAY,EAAA;IACvE,MAAM,MAAM,GAAW,EAAE,GAAG,iBAAiB,CAAC,IAAI,EAAE,EAAE,CAAC;IACvD,MAAM,CAAC,GAAG,SAAS,GAAG,CAAC,GAAG,aAAa,GAAG,MAAM,GAAG,aAAa;AAChE,IAAA,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AACtB;AAEA;;;;;;;;;;;;AAYG;AACG,SAAU,cAAc,CAAC,KAAgB,EAAA;IAC7C,MAAM,YAAY,GAAW,CAAC,KAAK,CAAC,QAAQ,GAAG,EAAE,IAAI,CAAC;AACtD,IAAA,MAAM,MAAM,GAAW,IAAI,CAAC,KAAK,CAC/B,IAAI,IAAI,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CACjD;IAED,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE;;;;IAK7B,MAAM,IAAI,GAAW,WAAW;AAChC,IAAA,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC;AACtC,QAAA,IAAI,EAAE,EAAE,CAAC,WAAW,EAAE;AACtB,QAAA,KAAK,EAAE,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC;AACxB,QAAA,GAAG,EAAE,EAAE,CAAC,OAAO,EAAE;QACjB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,MAAM,EAAE,KAAK,CAAC,OAAO;AACrB,QAAA,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;AAChC,QAAA,WAAW,EAAE,MAAM;AACnB,QAAA,QAAQ,EAAE,IAAI;AACf,KAAA,CAAC;AAEF,IAAA,MAAM,SAAS,GAAW,OAAO,CAAC;IAClC,MAAM,MAAM,GAAG,sBAAsB,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC;;AAE1D,IAAA,MAAM,IAAI,GAAG,GAAG,CAAC,QAAQ,CAAC,EAAC,YAAY,EAAE,MAAM,EAAC,CAAC;AACjD,IAAA,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;AACjC;;;;"}
@@ -20,7 +20,7 @@ export type OmerLang = 'en' | 'he' | 'translit';
20
20
  * const ev = new OmerEvent(new HDate(16, months.NISAN, 5784), 1);
21
21
  * ev.render('en'); // '1st day of the Omer'
22
22
  * ev.render('he'); // 'א׳ בָּעוֹמֶר'
23
- * ev.sefira('translit'); // 'Chesed shebChesed'
23
+ * ev.sefira('translit'); // "Chesed sheb'Chesed"
24
24
  * ev.getTodayIs('en'); // 'Today is 1 day of the Omer'
25
25
  */
26
26
  export declare class OmerEvent extends Event {
@@ -68,12 +68,28 @@ export declare class OmerEvent extends Event {
68
68
  * @returns a single Unicode character from `①` through `㊾`
69
69
  */
70
70
  getEmoji(): string;
71
+ /**
72
+ * Number of *completed* weeks of the Omer. On day 7 this returns `1`; on
73
+ * day 8 it also returns `1`, because the second week is still in progress.
74
+ * Pair with {@link getDaysWithinWeeks} to render "N weeks and M days".
75
+ */
71
76
  getWeeks(): number;
77
+ /**
78
+ * Day within the current week, from `1` through `7`.
79
+ */
72
80
  getDaysWithinWeeks(): number;
73
81
  /**
74
82
  * Returns a sentence with that evening's omer count
75
- * @returns a string such as `Today is 10 days, which is 1 week and 3 days of the Omer`
76
- * or `הַיוֹם עֲשָׂרָה יָמִים, שְׁהֵם שָׁבוּעַ אֶחָד וְשְׁלוֹשָׁה יָמִים לָעוֹמֶר`
83
+ * @example
84
+ * import {OmerEvent, HDate, months} from '@hebcal/core';
85
+ * const ev = new OmerEvent(new HDate(25, months.NISAN, 5784), 10);
86
+ * ev.getTodayIs('en');
87
+ * // => 'Today is 10 days, which are 1 week and 3 days of the Omer'
88
+ * ev.getTodayIs('he');
89
+ * // => 'הַיּוֹם עֲשָׂרָה יָמִים, שֶׁהֵם שָׁבֽוּעַ אֶחָד וּשְׁלוֹשָׁה יָמִים לָעֽוֹמֶר'
90
+ * @param locale locale name; Hebrew locales (`he`, `he-x-NoNikud`) produce
91
+ * the Hebrew formula, anything else produces English. Defaults to `en`
92
+ * when empty.
77
93
  */
78
94
  getTodayIs(locale: string): string;
79
95
  url(): string | undefined;
package/dist/esm/omer.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.8.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.9.0, 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';
@@ -204,7 +204,7 @@ const lamnatzeachLetters = sefira.lamnatzeachLetters.split('');
204
204
  * const ev = new OmerEvent(new HDate(16, months.NISAN, 5784), 1);
205
205
  * ev.render('en'); // '1st day of the Omer'
206
206
  * ev.render('he'); // 'א׳ בָּעוֹמֶר'
207
- * ev.sefira('translit'); // 'Chesed shebChesed'
207
+ * ev.sefira('translit'); // "Chesed sheb'Chesed"
208
208
  * ev.getTodayIs('en'); // 'Today is 1 day of the Omer'
209
209
  */
210
210
  class OmerEvent extends Event {
@@ -302,17 +302,33 @@ class OmerEvent extends Event {
302
302
  }
303
303
  return String.fromCodePoint(codePoint);
304
304
  }
305
+ /**
306
+ * Number of *completed* weeks of the Omer. On day 7 this returns `1`; on
307
+ * day 8 it also returns `1`, because the second week is still in progress.
308
+ * Pair with {@link getDaysWithinWeeks} to render "N weeks and M days".
309
+ */
305
310
  getWeeks() {
306
311
  const day7 = this.daysWithinWeeks === 7;
307
312
  return day7 ? this.weekNumber : this.weekNumber - 1;
308
313
  }
314
+ /**
315
+ * Day within the current week, from `1` through `7`.
316
+ */
309
317
  getDaysWithinWeeks() {
310
318
  return this.daysWithinWeeks;
311
319
  }
312
320
  /**
313
321
  * Returns a sentence with that evening's omer count
314
- * @returns a string such as `Today is 10 days, which is 1 week and 3 days of the Omer`
315
- * or `הַיוֹם עֲשָׂרָה יָמִים, שְׁהֵם שָׁבוּעַ אֶחָד וְשְׁלוֹשָׁה יָמִים לָעוֹמֶר`
322
+ * @example
323
+ * import {OmerEvent, HDate, months} from '@hebcal/core';
324
+ * const ev = new OmerEvent(new HDate(25, months.NISAN, 5784), 10);
325
+ * ev.getTodayIs('en');
326
+ * // => 'Today is 10 days, which are 1 week and 3 days of the Omer'
327
+ * ev.getTodayIs('he');
328
+ * // => 'הַיּוֹם עֲשָׂרָה יָמִים, שֶׁהֵם שָׁבֽוּעַ אֶחָד וּשְׁלוֹשָׁה יָמִים לָעֽוֹמֶר'
329
+ * @param locale locale name; Hebrew locales (`he`, `he-x-NoNikud`) produce
330
+ * the Hebrew formula, anything else produces English. Defaults to `en`
331
+ * when empty.
316
332
  */
317
333
  getTodayIs(locale) {
318
334
  locale = (locale || 'en').toLowerCase();
@@ -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/**\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,QAA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I,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 sheb'Chesed\"\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 /**\n * Number of *completed* weeks of the Omer. On day 7 this returns `1`; on\n * day 8 it also returns `1`, because the second week is still in progress.\n * Pair with {@link getDaysWithinWeeks} to render \"N weeks and M days\".\n */\n getWeeks(): number {\n const day7 = this.daysWithinWeeks === 7;\n return day7 ? this.weekNumber : this.weekNumber - 1;\n }\n\n /**\n * Day within the current week, from `1` through `7`.\n */\n getDaysWithinWeeks(): number {\n return this.daysWithinWeeks;\n }\n /**\n * Returns a sentence with that evening's omer count\n * @example\n * import {OmerEvent, HDate, months} from '@hebcal/core';\n * const ev = new OmerEvent(new HDate(25, months.NISAN, 5784), 10);\n * ev.getTodayIs('en');\n * // => 'Today is 10 days, which are 1 week and 3 days of the Omer'\n * ev.getTodayIs('he');\n * // => 'הַיּוֹם עֲשָׂרָה יָמִים, שֶׁהֵם שָׁבֽוּעַ אֶחָד וּשְׁלוֹשָׁה יָמִים לָעֽוֹמֶר'\n * @param locale locale name; Hebrew locales (`he`, `he-x-NoNikud`) produce\n * the Hebrew formula, anything else produces English. Defaults to `en`\n * when empty.\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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AE;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,4 +1,4 @@
1
- /*! @hebcal/core v6.8.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.9.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import './locale.js';
3
3
  import { smartApostrophe } from './string.js';
4
4
  import { Locale } from '@hebcal/hdate';
@@ -10,8 +10,8 @@ import { ParshaEvent } from './ParshaEvent';
10
10
  * @example
11
11
  * import {parshaYear} from '@hebcal/core';
12
12
  * const events = parshaYear(5784, false);
13
- * events[0].render('en'); // 'Parashat Vayeilech'
14
- * events[0].getDate().toString(); // '4 Tishrei 5784'
13
+ * events[0].render('en'); // 'Parashat Ha’azinu'
14
+ * events[0].getDate().toString(); // '8 Tishrei 5784'
15
15
  * @param year Hebrew year
16
16
  * @param il Israel (false for Diaspora)
17
17
  * @returns an array of `ParshaEvent` occurring on Saturdays that contain a regular
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.8.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.9.0, 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';
@@ -14,8 +14,8 @@ import { getSedra } from './sedra.js';
14
14
  * @example
15
15
  * import {parshaYear} from '@hebcal/core';
16
16
  * const events = parshaYear(5784, false);
17
- * events[0].render('en'); // 'Parashat Vayeilech'
18
- * events[0].getDate().toString(); // '4 Tishrei 5784'
17
+ * events[0].render('en'); // 'Parashat Ha’azinu'
18
+ * events[0].getDate().toString(); // '8 Tishrei 5784'
19
19
  * @param year Hebrew year
20
20
  * @param il Israel (false for Diaspora)
21
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 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
+ {"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 Ha’azinu'\n * events[0].getDate().toString(); // '8 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.8.2";
2
+ export declare const version = "6.9.0";
@@ -1,6 +1,6 @@
1
- /*! @hebcal/core v6.8.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.9.0, 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.8.2';
3
+ const version = '6.9.0';
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.8.2';\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.9.0';\n"],"names":[],"mappings":";AAAA;AACO,MAAM,OAAO,GAAG;;;;"}
@@ -1,8 +1,20 @@
1
1
  import { CalOptions } from './CalOptions';
2
2
  /**
3
- * @private
3
+ * Helper function to format a 24-hour (00:00-23:59) time string in either
4
+ * 12-hour US format (e.g. `"8:13pm"`) or keep it in 24-hour format (e.g.
5
+ * `"20:13"`) for any other locale or country.
6
+ *
7
+ * The locale (and therefore default behavior) is derived from
8
+ * `options.location` / `options.locale`. The `options.hour12` override
9
+ * takes precedence: if `false`, locale is ignored and the result is always
10
+ * 24-hour; if `true`, locale is ignored and the result is always 12-hour.
11
+ * @example
12
+ * import {reformatTimeStr, Location} from '@hebcal/core';
13
+ * const opts = {location: Location.lookup('Chicago')};
14
+ * reformatTimeStr('20:30', 'pm', opts); // '8:30pm'
15
+ * reformatTimeStr('20:30', 'pm', {hour12: false}); // '20:30'
4
16
  * @param timeStr - original time like "20:30"
5
17
  * @param suffix - "p" or "pm" or " P.M.". Add leading space if you want it
6
- * @param options
18
+ * @param options optional; `location`, `locale` and `hour12` are consulted
7
19
  */
8
20
  export declare function reformatTimeStr(timeStr: string, suffix: string, options?: CalOptions): string;
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.8.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.9.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  const hour12cc = {
3
3
  US: 1,
4
4
  CA: 1,
@@ -14,10 +14,22 @@ const hour12cc = {
14
14
  ZA: 1,
15
15
  };
16
16
  /**
17
- * @private
17
+ * Helper function to format a 24-hour (00:00-23:59) time string in either
18
+ * 12-hour US format (e.g. `"8:13pm"`) or keep it in 24-hour format (e.g.
19
+ * `"20:13"`) for any other locale or country.
20
+ *
21
+ * The locale (and therefore default behavior) is derived from
22
+ * `options.location` / `options.locale`. The `options.hour12` override
23
+ * takes precedence: if `false`, locale is ignored and the result is always
24
+ * 24-hour; if `true`, locale is ignored and the result is always 12-hour.
25
+ * @example
26
+ * import {reformatTimeStr, Location} from '@hebcal/core';
27
+ * const opts = {location: Location.lookup('Chicago')};
28
+ * reformatTimeStr('20:30', 'pm', opts); // '8:30pm'
29
+ * reformatTimeStr('20:30', 'pm', {hour12: false}); // '20:30'
18
30
  * @param timeStr - original time like "20:30"
19
31
  * @param suffix - "p" or "pm" or " P.M.". Add leading space if you want it
20
- * @param options
32
+ * @param options optional; `location`, `locale` and `hour12` are consulted
21
33
  */
22
34
  function reformatTimeStr(timeStr, suffix, options) {
23
35
  if (typeof timeStr !== 'string')
@@ -1 +1 @@
1
- {"version":3,"file":"reformatTimeStr.js","sources":["../../../src/reformatTimeStr.ts"],"sourcesContent":["import {CalOptions} from './CalOptions';\n\nconst hour12cc: Record<string, number> = {\n US: 1,\n CA: 1,\n BR: 1,\n AU: 1,\n NZ: 1,\n DO: 1,\n PR: 1,\n GR: 1,\n IN: 1,\n KR: 1,\n NP: 1,\n ZA: 1,\n} as const;\n\n/**\n * @private\n * @param timeStr - original time like \"20:30\"\n * @param suffix - \"p\" or \"pm\" or \" P.M.\". Add leading space if you want it\n * @param options\n */\nexport function reformatTimeStr(\n timeStr: string,\n suffix: string,\n options?: CalOptions\n): string {\n if (typeof timeStr !== 'string') throw new TypeError(`Bad timeStr: ${timeStr}`);\n const cc = options?.location?.getCountryCode() || (options?.il ? 'IL' : 'US');\n const hour12 = options?.hour12;\n if (hour12 !== undefined && !hour12) {\n return timeStr;\n }\n if (!hour12 && hour12cc[cc] === undefined) {\n return timeStr;\n }\n const hm = timeStr.split(':');\n let hour: string | number = parseInt(hm[0], 10);\n if (hour < 12 && suffix) {\n suffix = suffix.replace('p', 'a').replace('P', 'A');\n if (hour === 0) {\n hour = 12;\n }\n } else if (hour > 12) {\n hour = hour % 12;\n } else if (hour === 0) {\n hour = '00';\n }\n return `${hour}:${hm[1]}${suffix}`;\n}\n"],"names":[],"mappings":";AAEA,MAAM,QAAQ,GAA2B;AACvC,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,EAAE,EAAE,CAA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AAM,CAAA,CAAE;AACpC;;;;"}
1
+ {"version":3,"file":"reformatTimeStr.js","sources":["../../../src/reformatTimeStr.ts"],"sourcesContent":["import {CalOptions} from './CalOptions';\n\nconst hour12cc: Record<string, number> = {\n US: 1,\n CA: 1,\n BR: 1,\n AU: 1,\n NZ: 1,\n DO: 1,\n PR: 1,\n GR: 1,\n IN: 1,\n KR: 1,\n NP: 1,\n ZA: 1,\n} as const;\n\n/**\n * Helper function to format a 24-hour (00:00-23:59) time string in either\n * 12-hour US format (e.g. `\"8:13pm\"`) or keep it in 24-hour format (e.g.\n * `\"20:13\"`) for any other locale or country.\n *\n * The locale (and therefore default behavior) is derived from\n * `options.location` / `options.locale`. The `options.hour12` override\n * takes precedence: if `false`, locale is ignored and the result is always\n * 24-hour; if `true`, locale is ignored and the result is always 12-hour.\n * @example\n * import {reformatTimeStr, Location} from '@hebcal/core';\n * const opts = {location: Location.lookup('Chicago')};\n * reformatTimeStr('20:30', 'pm', opts); // '8:30pm'\n * reformatTimeStr('20:30', 'pm', {hour12: false}); // '20:30'\n * @param timeStr - original time like \"20:30\"\n * @param suffix - \"p\" or \"pm\" or \" P.M.\". Add leading space if you want it\n * @param options optional; `location`, `locale` and `hour12` are consulted\n */\nexport function reformatTimeStr(\n timeStr: string,\n suffix: string,\n options?: CalOptions\n): string {\n if (typeof timeStr !== 'string') throw new TypeError(`Bad timeStr: ${timeStr}`);\n const cc = options?.location?.getCountryCode() || (options?.il ? 'IL' : 'US');\n const hour12 = options?.hour12;\n if (hour12 !== undefined && !hour12) {\n return timeStr;\n }\n if (!hour12 && hour12cc[cc] === undefined) {\n return timeStr;\n }\n const hm = timeStr.split(':');\n let hour: string | number = parseInt(hm[0], 10);\n if (hour < 12 && suffix) {\n suffix = suffix.replace('p', 'a').replace('P', 'A');\n if (hour === 0) {\n hour = 12;\n }\n } else if (hour > 12) {\n hour = hour % 12;\n } else if (hour === 0) {\n hour = '00';\n }\n return `${hour}:${hm[1]}${suffix}`;\n}\n"],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AAG,EAAE,GAAG,CAAC;AACnD,QAAA,IAAI,IAAI,KAAK,CAAC,EAAE;YACd,IAAI,GAAG,EAAE;QACX;IACF;AAAO,SAAA,IAAI,IAAI,GAAG,EAAE,EAAE;AACpB,QAAA,IAAI,GAAG,IAAI,GAAG,EAAE;IAClB;AAAO,SAAA,IAAI,IAAI,KAAK,CAAC,EAAE;QACrB,IAAI,GAAG,IAAI;IACb;IACA,OAAO,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,EAAE,CAAC,CAAC,CAAC,CAAA,EAAG,MAAM,CAAA,CAAE;AACpC;;;;"}
@@ -36,14 +36,14 @@ export type SedraResult = {
36
36
  * Israel and the Diaspora diverge in some years when the 8th day of Pesach
37
37
  * or the 2nd day of Shavuot fall on Shabbat).
38
38
  *
39
- * Prefer {@link getSedra} (or {@link HebrewCalendar.getSedra}) over
39
+ * Prefer {@link getSedra} over
40
40
  * calling this constructor directly, since both cache their results.
41
41
  *
42
42
  * @example
43
43
  * import {Sedra, HDate, months} from '@hebcal/core';
44
44
  * const sedra = new Sedra(5784, false);
45
45
  * const result = sedra.lookup(new HDate(15, months.CHESHVAN, 5784));
46
- * console.log(result.parsha); // ['Lech-Lecha']
46
+ * console.log(result.parsha); // ['Vayera']
47
47
  */
48
48
  export declare class Sedra {
49
49
  private readonly year;
@@ -72,15 +72,20 @@ export declare class Sedra {
72
72
  * @example
73
73
  * import {Sedra} from '@hebcal/core';
74
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
75
+ * sedra.find('Noach')?.toString(); // '6 Cheshvan 5784'
76
+ * sedra.find(1)?.toString(); // '6 Cheshvan 5784', by 0-based index
77
+ * // Matot and Masei are doubled in 5784, so the pair has a date...
78
+ * sedra.find('Matot-Masei')?.toString(); // '28 Tamuz 5784'
79
+ * sedra.find(['Matot', 'Masei'])?.toString(); // '28 Tamuz 5784'
80
+ * // ...but neither half is read on its own that year:
81
+ * sedra.find('Matot'); // null
79
82
  * @param parsha if a `string`, specified with Sephardic transliterations
80
83
  * like `'Noach'` or `'Matot-Masei'`. If an array, must be a 1- or 2-element
81
84
  * array such as `['Noach']` or `['Matot', 'Masei']`. If a `number`, should
82
85
  * be a 0-based parsha index (`0` for Bereshit, `1` for Noach) or a negative
83
- * number for a doubled parsha (e.g. `-21` for Vayakhel-Pekudei)
86
+ * number for a doubled parsha (e.g. `-21` for Vayakhel-Pekudei).
87
+ * Note that this index is 0-based, unlike {@link SedraResult.num} which
88
+ * is 1-based.
84
89
  */
85
90
  find(parsha: number | string | string[]): HDate | null;
86
91
  private findInternal;
@@ -95,12 +100,19 @@ export declare class Sedra {
95
100
  * will return the date of `'Matot'` alone.
96
101
  * @example
97
102
  * import {Sedra} from '@hebcal/core';
103
+ * // Matot and Masei are doubled in 5784, so each half resolves to the
104
+ * // date of the combined reading:
98
105
  * 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'
106
+ * sedra.findContaining('Matot')?.toString(); // '28 Tamuz 5784'
107
+ * sedra.findContaining('Masei')?.toString(); // '28 Tamuz 5784'
108
+ * @example
109
+ * import {Sedra} from '@hebcal/core';
110
+ * // They are read separately in 5795, so each half has its own date, and
111
+ * // asking for the doubled name returns the date of the first half:
112
+ * const sedra = new Sedra(5795, false);
113
+ * sedra.findContaining('Matot')?.toString(); // '21 Tamuz 5795'
114
+ * sedra.findContaining('Masei')?.toString(); // '28 Tamuz 5795'
115
+ * sedra.findContaining('Matot-Masei')?.toString(); // '21 Tamuz 5795'
104
116
  */
105
117
  findContaining(parsha: number | string): HDate | null;
106
118
  /**
@@ -137,11 +149,11 @@ export declare class Sedra {
137
149
  * @example
138
150
  * import {Sedra, HDate, months} from '@hebcal/core';
139
151
  * 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));
152
+ * // A Friday — returns the upcoming Shabbat's reading
153
+ * const result = sedra.lookup(new HDate(12, months.CHESHVAN, 5784));
142
154
  * console.log(result.parsha); // ['Lech-Lecha']
143
155
  * console.log(result.chag); // false
144
- * console.log(result.hdate.toString()); // '15 Cheshvan 5784' (Saturday)
156
+ * console.log(result.hdate.toString()); // '13 Cheshvan 5784' (Saturday)
145
157
  * @param hd Hebrew date or R.D. days
146
158
  */
147
159
  lookup(hd: HDate | number): SedraResult;
@@ -155,6 +167,16 @@ export declare class Sedra {
155
167
  *
156
168
  * For the Tishrei weekdays before Sukkot or Simchat Torah, the weekday
157
169
  * reading is *Vezot Haberakhah* even though it is not read on Shabbat.
170
+ * @example
171
+ * import {Sedra, HDate, months} from '@hebcal/core';
172
+ * const sedra = new Sedra(5784, false);
173
+ * // Monday 8 Cheshvan — begins the upcoming Shabbat's parsha
174
+ * sedra.lookupWeekday(new HDate(8, months.CHESHVAN, 5784))?.parsha; // ['Lech-Lecha']
175
+ * // Tuesday is neither Monday nor Thursday
176
+ * sedra.lookupWeekday(new HDate(9, months.CHESHVAN, 5784)); // undefined
177
+ * // Thursday 17 Nisan — the upcoming Shabbat is Chol ha-Moed Pesach,
178
+ * // so the next regular parsha is returned instead
179
+ * sedra.lookupWeekday(new HDate(17, months.NISAN, 5784))?.parsha; // ['Achrei Mot']
158
180
  * @param hd Hebrew date or R.D. days
159
181
  */
160
182
  lookupWeekday(hd: HDate | number): SedraResult | undefined;
@@ -170,7 +192,12 @@ export declare class Sedra {
170
192
  * @type {string[]}
171
193
  */
172
194
  export declare const parshiot: readonly string[];
173
- type NumberOrString = number | string;
195
+ /**
196
+ * An entry in the array returned by {@link Sedra.getSedraArray}: either a
197
+ * `number` identifying a parsha (or, when negative, a doubled parsha) or a
198
+ * `string` naming the holiday that displaces the weekly reading.
199
+ */
200
+ export type NumberOrString = number | string;
174
201
  /**
175
202
  * Convenience function to create an instance of {@link Sedra} or reuse a
176
203
  * previously created and cached instance for the same year and schedule.
@@ -181,9 +208,8 @@ type NumberOrString = number | string;
181
208
  * import {getSedra, HDate, months} from '@hebcal/core';
182
209
  * const sedra = getSedra(5784, false);
183
210
  * const {parsha} = sedra.lookup(new HDate(15, months.CHESHVAN, 5784));
184
- * console.log(parsha); // ['Lech-Lecha']
211
+ * console.log(parsha); // ['Vayera']
185
212
  * @param hyear Hebrew year
186
213
  * @param il Use Israel sedra schedule (`false` for Diaspora)
187
214
  */
188
215
  export declare function getSedra(hyear: number, il: boolean): Sedra;
189
- export {};