@hebcal/core 6.5.0 → 6.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/dist/bundle.js +5983 -5473
  2. package/dist/bundle.js.map +1 -1
  3. package/dist/bundle.min.js +17 -17
  4. package/dist/bundle.min.js.map +1 -1
  5. package/dist/esm/CalOptions.d.ts +7 -4
  6. package/dist/esm/DailyLearning.d.ts +44 -7
  7. package/dist/esm/DailyLearning.js +45 -8
  8. package/dist/esm/DailyLearning.js.map +1 -1
  9. package/dist/esm/HebrewDateEvent.js +1 -1
  10. package/dist/esm/HolidayEvent.d.ts +34 -1
  11. package/dist/esm/HolidayEvent.js +35 -2
  12. package/dist/esm/HolidayEvent.js.map +1 -1
  13. package/dist/esm/MevarchimChodeshEvent.js +1 -1
  14. package/dist/esm/ParshaEvent.js +1 -1
  15. package/dist/esm/TimedEvent.d.ts +32 -3
  16. package/dist/esm/TimedEvent.js +33 -4
  17. package/dist/esm/TimedEvent.js.map +1 -1
  18. package/dist/esm/YomKippurKatanEvent.js +1 -1
  19. package/dist/esm/ashkenazi.po.d.ts +1 -0
  20. package/dist/esm/ashkenazi.po.js +2 -2
  21. package/dist/esm/ashkenazi.po.js.map +1 -1
  22. package/dist/esm/calendar.d.ts +1 -0
  23. package/dist/esm/calendar.js +12 -2
  24. package/dist/esm/calendar.js.map +1 -1
  25. package/dist/esm/candles.d.ts +14 -1
  26. package/dist/esm/candles.js +15 -2
  27. package/dist/esm/candles.js.map +1 -1
  28. package/dist/esm/cities.json.js +5 -0
  29. package/dist/esm/cities.json.js.map +1 -0
  30. package/dist/esm/event.d.ts +58 -13
  31. package/dist/esm/event.js +59 -14
  32. package/dist/esm/event.js.map +1 -1
  33. package/dist/esm/getStartAndEnd.js +10 -2
  34. package/dist/esm/getStartAndEnd.js.map +1 -1
  35. package/dist/esm/hallel.js +20 -28
  36. package/dist/esm/hallel.js.map +1 -1
  37. package/dist/esm/he-x-NoNikud.po.js +1 -1
  38. package/dist/esm/he.po.d.ts +1 -0
  39. package/dist/esm/he.po.js +2 -2
  40. package/dist/esm/he.po.js.map +1 -1
  41. package/dist/esm/hebcal.d.ts +97 -19
  42. package/dist/esm/hebcal.js +102 -21
  43. package/dist/esm/hebcal.js.map +1 -1
  44. package/dist/esm/holidays.d.ts +21 -2
  45. package/dist/esm/holidays.js +39 -3
  46. package/dist/esm/holidays.js.map +1 -1
  47. package/dist/esm/index.d.ts +1 -1
  48. package/dist/esm/index.js +2 -1
  49. package/dist/esm/index.js.map +1 -1
  50. package/dist/esm/isAssurBemlacha.d.ts +24 -4
  51. package/dist/esm/isAssurBemlacha.js +25 -5
  52. package/dist/esm/isAssurBemlacha.js.map +1 -1
  53. package/dist/esm/isAveilut.d.ts +14 -3
  54. package/dist/esm/isAveilut.js +15 -4
  55. package/dist/esm/isAveilut.js.map +1 -1
  56. package/dist/esm/isFastDay.d.ts +13 -1
  57. package/dist/esm/isFastDay.js +14 -2
  58. package/dist/esm/isFastDay.js.map +1 -1
  59. package/dist/esm/locale.js +1 -1
  60. package/dist/esm/location.d.ts +96 -8
  61. package/dist/esm/location.js +112 -88
  62. package/dist/esm/location.js.map +1 -1
  63. package/dist/esm/modern.js +1 -1
  64. package/dist/esm/molad.d.ts +39 -7
  65. package/dist/esm/molad.js +40 -8
  66. package/dist/esm/molad.js.map +1 -1
  67. package/dist/esm/moladBase.js +1 -1
  68. package/dist/esm/moladDate.js +1 -1
  69. package/dist/esm/omer.d.ts +32 -4
  70. package/dist/esm/omer.js +33 -5
  71. package/dist/esm/omer.js.map +1 -1
  72. package/dist/esm/parshaName.js +1 -1
  73. package/dist/esm/parshaYear.d.ts +12 -1
  74. package/dist/esm/parshaYear.js +13 -2
  75. package/dist/esm/parshaYear.js.map +1 -1
  76. package/dist/esm/pkgVersion.d.ts +1 -1
  77. package/dist/esm/pkgVersion.js +2 -2
  78. package/dist/esm/pkgVersion.js.map +1 -1
  79. package/dist/esm/reformatTimeStr.js +1 -1
  80. package/dist/esm/sedra.d.ts +94 -14
  81. package/dist/esm/sedra.js +95 -15
  82. package/dist/esm/sedra.js.map +1 -1
  83. package/dist/esm/sefira.json.js +1 -1
  84. package/dist/esm/staticHolidays.d.ts +2 -0
  85. package/dist/esm/staticHolidays.js +3 -1
  86. package/dist/esm/staticHolidays.js.map +1 -1
  87. package/dist/esm/tachanun.js +1 -1
  88. package/dist/esm/temporal-shim.js +1 -1
  89. package/dist/esm/zmanim.js +1 -1
  90. package/dist/src/CalOptions.d.ts +7 -4
  91. package/dist/src/DailyLearning.d.ts +44 -7
  92. package/dist/src/DailyLearning.js +44 -7
  93. package/dist/src/HolidayEvent.d.ts +34 -1
  94. package/dist/src/HolidayEvent.js +34 -1
  95. package/dist/src/TimedEvent.d.ts +32 -3
  96. package/dist/src/TimedEvent.js +32 -3
  97. package/dist/src/ashkenazi.po.d.ts +1 -0
  98. package/dist/src/ashkenazi.po.js +1 -1
  99. package/dist/src/calendar.d.ts +1 -0
  100. package/dist/src/calendar.js +11 -1
  101. package/dist/src/candles.d.ts +14 -1
  102. package/dist/src/candles.js +14 -1
  103. package/dist/src/cities.json +67 -0
  104. package/dist/src/event.d.ts +58 -13
  105. package/dist/src/event.js +58 -13
  106. package/dist/src/getStartAndEnd.js +9 -1
  107. package/dist/src/hallel.js +19 -27
  108. package/dist/src/he.po.d.ts +1 -0
  109. package/dist/src/he.po.js +1 -1
  110. package/dist/src/hebcal.d.ts +97 -19
  111. package/dist/src/hebcal.js +101 -20
  112. package/dist/src/holidays.d.ts +21 -2
  113. package/dist/src/holidays.js +38 -2
  114. package/dist/src/index.d.ts +1 -1
  115. package/dist/src/index.js +1 -0
  116. package/dist/src/isAssurBemlacha.d.ts +24 -4
  117. package/dist/src/isAssurBemlacha.js +24 -4
  118. package/dist/src/isAveilut.d.ts +14 -3
  119. package/dist/src/isAveilut.js +14 -3
  120. package/dist/src/isFastDay.d.ts +13 -1
  121. package/dist/src/isFastDay.js +13 -1
  122. package/dist/src/location.d.ts +96 -8
  123. package/dist/src/location.js +111 -87
  124. package/dist/src/molad.d.ts +39 -7
  125. package/dist/src/molad.js +39 -7
  126. package/dist/src/omer.d.ts +32 -4
  127. package/dist/src/omer.js +32 -4
  128. package/dist/src/parshaYear.d.ts +12 -1
  129. package/dist/src/parshaYear.js +12 -1
  130. package/dist/src/pkgVersion.d.ts +1 -1
  131. package/dist/src/pkgVersion.js +1 -1
  132. package/dist/src/sedra.d.ts +94 -14
  133. package/dist/src/sedra.js +94 -14
  134. package/dist/src/staticHolidays.d.ts +2 -0
  135. package/dist/src/staticHolidays.js +2 -0
  136. package/package.json +6 -6
@@ -19,80 +19,8 @@
19
19
  along with this program. If not, see <http://www.gnu.org/licenses/>.
20
20
  */
21
21
  import { GeoLocation } from '@hebcal/noaa';
22
- const classicCities0 = [
23
- ['Ashdod', 'IL', 31.79213, 34.64966, 'Asia/Jerusalem', 27],
24
- ['Atlanta', 'US', 33.749, -84.38798, 'America/New_York', 336],
25
- ['Austin', 'US', 30.26715, -97.74306, 'America/Chicago', 165],
26
- ['Baghdad', 'IQ', 33.34058, 44.40088, 'Asia/Baghdad', 41],
27
- ['Beer Sheva', 'IL', 31.25181, 34.7913, 'Asia/Jerusalem', 285],
28
- ['Berlin', 'DE', 52.52437, 13.41053, 'Europe/Berlin', 43],
29
- ['Baltimore', 'US', 39.29038, -76.61219, 'America/New_York', 35],
30
- ['Bogota', 'CO', 4.60971, -74.08175, 'America/Bogota', 2582],
31
- ['Boston', 'US', 42.35843, -71.05977, 'America/New_York', 38],
32
- ['Budapest', 'HU', 47.49801, 19.03991, 'Europe/Budapest', 104],
33
- [
34
- 'Buenos Aires',
35
- 'AR',
36
- -34.61315,
37
- -58.37723,
38
- 'America/Argentina/Buenos_Aires',
39
- 31,
40
- ],
41
- ['Buffalo', 'US', 42.88645, -78.87837, 'America/New_York', 191],
42
- ['Chicago', 'US', 41.85003, -87.65005, 'America/Chicago', 180],
43
- ['Cincinnati', 'US', 39.162, -84.45689, 'America/New_York', 267],
44
- ['Cleveland', 'US', 41.4995, -81.69541, 'America/New_York', 204],
45
- ['Dallas', 'US', 32.78306, -96.80667, 'America/Chicago', 139],
46
- ['Denver', 'US', 39.73915, -104.9847, 'America/Denver', 1636],
47
- ['Detroit', 'US', 42.33143, -83.04575, 'America/Detroit', 192],
48
- ['Eilat', 'IL', 29.55805, 34.94821, 'Asia/Jerusalem', 63],
49
- ['Gibraltar', 'GI', 36.14474, -5.35257, 'Europe/Gibraltar', 11],
50
- ['Haifa', 'IL', 32.81841, 34.9885, 'Asia/Jerusalem', 40],
51
- ['Hawaii', 'US', 21.30694, -157.85833, 'Pacific/Honolulu', 18],
52
- ['Helsinki', 'FI', 60.16952, 24.93545, 'Europe/Helsinki', 26],
53
- ['Houston', 'US', 29.76328, -95.36327, 'America/Chicago', 30],
54
- ['Jerusalem', 'IL', 31.76904, 35.21633, 'Asia/Jerusalem', 786],
55
- ['Johannesburg', 'ZA', -26.20227, 28.04363, 'Africa/Johannesburg', 1767],
56
- ['Kiev', 'UA', 50.45466, 30.5238, 'Europe/Kiev', 187],
57
- ['La Paz', 'BO', -16.5, -68.15, 'America/La_Paz', 3782],
58
- ['Livingston', 'US', 40.79593, -74.31487, 'America/New_York', 98],
59
- ['Las Vegas', 'US', 36.17497, -115.13722, 'America/Los_Angeles', 613],
60
- ['London', 'GB', 51.50853, -0.12574, 'Europe/London', 25],
61
- ['Los Angeles', 'US', 34.05223, -118.24368, 'America/Los_Angeles', 96],
62
- ['Marseilles', 'FR', 43.29695, 5.38107, 'Europe/Paris', 28],
63
- ['Miami', 'US', 25.77427, -80.19366, 'America/New_York', 25],
64
- ['Minneapolis', 'US', 44.97997, -93.26384, 'America/Chicago', 262],
65
- ['Melbourne', 'AU', -37.814, 144.96332, 'Australia/Melbourne', 25],
66
- ['Mexico City', 'MX', 19.42847, -99.12766, 'America/Mexico_City', 2240],
67
- ['Montreal', 'CA', 45.50884, -73.58781, 'America/Toronto', 216],
68
- ['Moscow', 'RU', 55.75222, 37.61556, 'Europe/Moscow', 144],
69
- ['New York', 'US', 40.71427, -74.00597, 'America/New_York', 57],
70
- ['Omaha', 'US', 41.25861, -95.93779, 'America/Chicago', 315],
71
- ['Ottawa', 'CA', 45.41117, -75.69812, 'America/Toronto', 71],
72
- ['Panama City', 'PA', 8.9936, -79.51973, 'America/Panama', 17],
73
- ['Paris', 'FR', 48.85341, 2.3488, 'Europe/Paris', 42],
74
- ['Pawtucket', 'US', 41.87871, -71.38256, 'America/New_York', 0], // -11
75
- ['Petach Tikvah', 'IL', 32.08707, 34.88747, 'Asia/Jerusalem', 54],
76
- ['Philadelphia', 'US', 39.95233, -75.16379, 'America/New_York', 8],
77
- ['Phoenix', 'US', 33.44838, -112.07404, 'America/Phoenix', 366],
78
- ['Pittsburgh', 'US', 40.44062, -79.99589, 'America/New_York', 239],
79
- ['Providence', 'US', 41.82399, -71.41283, 'America/New_York', 0], // -15
80
- ['Portland', 'US', 45.52345, -122.67621, 'America/Los_Angeles', 15],
81
- ['Saint Louis', 'US', 38.62727, -90.19789, 'America/Chicago', 149],
82
- ['Saint Petersburg', 'RU', 59.93863, 30.31413, 'Europe/Moscow', 11],
83
- ['San Diego', 'US', 32.71533, -117.15726, 'America/Los_Angeles', 20],
84
- ['San Francisco', 'US', 37.77493, -122.41942, 'America/Los_Angeles', 28],
85
- ['Sao Paulo', 'BR', -23.5475, -46.63611, 'America/Sao_Paulo', 769],
86
- ['Seattle', 'US', 47.60621, -122.33207, 'America/Los_Angeles', 56],
87
- ['Sydney', 'AU', -33.86785, 151.20732, 'Australia/Sydney', 58],
88
- ['Tel Aviv', 'IL', 32.08088, 34.78057, 'Asia/Jerusalem', 15],
89
- ['Tiberias', 'IL', 32.79221, 35.53124, 'Asia/Jerusalem', 0], // -140
90
- ['Toronto', 'CA', 43.70011, -79.4163, 'America/Toronto', 175],
91
- ['Vancouver', 'CA', 49.24966, -123.11934, 'America/Vancouver', 70],
92
- ['White Plains', 'US', 41.03399, -73.76291, 'America/New_York', 82],
93
- ['Washington DC', 'US', 38.89511, -77.03637, 'America/New_York', 6],
94
- ['Worcester', 'US', 42.26259, -71.80229, 'America/New_York', 164],
95
- ];
22
+ import citiesJson from './cities.json';
23
+ import QuickLRU from 'quick-lru';
96
24
  const classicCities = new Map();
97
25
  // Zip-Codes.com TimeZone IDs
98
26
  const ZIPCODES_TZ_MAP = {
@@ -111,7 +39,9 @@ const ZIPCODES_TZ_MAP = {
111
39
  '16': 'Pacific/Chuuk', // Micronesia (GMT +11:00)
112
40
  };
113
41
  /** @private */
114
- const timeFormatCache = new Map();
42
+ const timeFormatCache = new QuickLRU({
43
+ maxSize: 120,
44
+ });
115
45
  /**
116
46
  * Gets a 24-hour time formatter (e.g. 07:41 or 20:03) from cache
117
47
  * or makes a new one if needed
@@ -130,7 +60,38 @@ function getFormatter(tzid) {
130
60
  timeFormatCache.set(tzid, f);
131
61
  return f;
132
62
  }
133
- /** Class representing Location */
63
+ function initClassicCities() {
64
+ for (const entry of citiesJson) {
65
+ const [cityName, cc, lat, lng, tzid, elev] = entry.split('|');
66
+ const location = new Location(+lat, +lng, cc === 'IL', tzid, cityName, cc, undefined, +elev);
67
+ Location.addLocation(cityName, location);
68
+ }
69
+ }
70
+ /**
71
+ * Class representing a geographic location for use with candle-lighting,
72
+ * havdalah, and zmanim calculations.
73
+ *
74
+ * Extends {@link GeoLocation} from `@hebcal/noaa` with Jewish-calendar
75
+ * specific data: an Israel/Diaspora flag, ISO country code, and an optional
76
+ * geographic identifier. Also provides {@link Location.lookup} for ~60
77
+ * built-in "classic" Hebcal cities.
78
+ *
79
+ * @example
80
+ * import {Location} from '@hebcal/core';
81
+ *
82
+ * // Create a location for a custom address
83
+ * const loc = new Location(
84
+ * 41.85003, // latitude
85
+ * -87.65005, // longitude
86
+ * false, // not in Israel
87
+ * 'America/Chicago',
88
+ * 'Chicago, Illinois, USA',
89
+ * 'US'
90
+ * );
91
+ *
92
+ * // Or look up a built-in classic city
93
+ * const tlv = Location.lookup('Tel Aviv');
94
+ */
134
95
  export class Location extends GeoLocation {
135
96
  il;
136
97
  cc;
@@ -173,14 +134,31 @@ export class Location extends GeoLocation {
173
134
  this.cc = countryCode;
174
135
  this.geoid = geoid;
175
136
  }
137
+ /**
138
+ * Returns `true` if this location is in Israel (uses the Israeli holiday
139
+ * and Torah-reading schedule), `false` for the Diaspora.
140
+ */
176
141
  getIsrael() {
177
142
  return this.il;
178
143
  }
144
+ /**
145
+ * Returns the full descriptive location name passed to the constructor,
146
+ * or `null` if no name was provided.
147
+ * @example
148
+ * Location.lookup('San Francisco')?.getName(); // 'San Francisco, California, USA'
149
+ */
179
150
  getName() {
180
151
  return this.getLocationName();
181
152
  }
182
153
  /**
183
- * Returns the location name, up to the first comma
154
+ * Returns the location name truncated at the first comma. Useful for
155
+ * compact display where only the city name is desired.
156
+ *
157
+ * Special-cased so that US locations of the form `"Washington, DC"` or
158
+ * `"Washington, D.C., ..."` keep the `DC` / `D.C.` suffix attached.
159
+ * @example
160
+ * Location.lookup('San Francisco')?.getShortName(); // 'San Francisco'
161
+ * Location.lookup('Washington DC')?.getShortName(); // 'Washington, DC'
184
162
  */
185
163
  getShortName() {
186
164
  const name = this.getLocationName();
@@ -199,18 +177,37 @@ export class Location extends GeoLocation {
199
177
  }
200
178
  return name.substring(0, comma);
201
179
  }
180
+ /**
181
+ * Returns the ISO 3166 alpha-2 country code (e.g. `"US"`, `"IL"`, `"FR"`)
182
+ * passed to the constructor, or `undefined` if none was provided.
183
+ */
202
184
  getCountryCode() {
203
185
  return this.cc;
204
186
  }
187
+ /**
188
+ * Returns the Olson timezone identifier (e.g. `"America/Chicago"`).
189
+ * Alias for `getTimeZone()` from the parent `GeoLocation` class.
190
+ */
205
191
  getTzid() {
206
192
  return this.getTimeZone();
207
193
  }
208
194
  /**
209
- * Gets a 24-hour time formatter (e.g. 07:41 or 20:03) for this location
195
+ * Returns a cached 24-hour `Intl.DateTimeFormat` (e.g. `07:41` or `20:03`)
196
+ * configured for this location's timezone. Formatters are memoized by
197
+ * timezone so repeated calls do not allocate.
198
+ * @example
199
+ * const loc = Location.lookup('Tel Aviv')!;
200
+ * const fmt = loc.getTimeFormatter();
201
+ * fmt.format(new Date()); // e.g. '18:42'
210
202
  */
211
203
  getTimeFormatter() {
212
204
  return getFormatter(this.getTimeZone());
213
205
  }
206
+ /**
207
+ * Returns the optional geographic identifier passed to the constructor
208
+ * (typically a GeoNames numeric ID or a US Zip Code string), or
209
+ * `undefined` if none was provided.
210
+ */
214
211
  getGeoId() {
215
212
  return this.geoid;
216
213
  }
@@ -230,16 +227,38 @@ export class Location extends GeoLocation {
230
227
  * 'San Diego', 'San Francisco', 'Sao Paulo', 'Seattle', 'Sydney',
231
228
  * 'Tel Aviv', 'Tiberias', 'Toronto', 'Vancouver', 'White Plains',
232
229
  * 'Washington DC', 'Worcester'
233
- * @param name
230
+ *
231
+ * Lookups are case-insensitive. Returns `undefined` if the name is not
232
+ * recognized. The list can be extended with {@link Location.addLocation}.
233
+ * @example
234
+ * const loc = Location.lookup('San Francisco');
235
+ * console.log(loc?.getTzid()); // 'America/Los_Angeles'
236
+ * @param name case-insensitive classic city name
234
237
  */
235
238
  static lookup(name) {
239
+ if (classicCities.size === 0) {
240
+ initClassicCities();
241
+ }
236
242
  return classicCities.get(name.toLowerCase());
237
243
  }
244
+ /**
245
+ * Returns a JSON-serialized representation of this Location.
246
+ * Useful for debugging and structured logging.
247
+ */
238
248
  toString() {
239
249
  return JSON.stringify(this);
240
250
  }
241
251
  /**
242
- * Converts legacy Hebcal timezone to a standard Olson tzid.
252
+ * Converts a legacy Hebcal-style timezone (a numeric GMT offset plus a
253
+ * coarse DST region) to a standard IANA/Olson timezone ID.
254
+ *
255
+ * This exists to migrate data from older Hebcal versions that stored
256
+ * timezones as GMT offset + DST scheme rather than as a full tzid.
257
+ * @example
258
+ * Location.legacyTzToTzid(2, 'israel'); // 'Asia/Jerusalem'
259
+ * Location.legacyTzToTzid(0, 'eu'); // 'Europe/London'
260
+ * Location.legacyTzToTzid(0, 'none'); // 'UTC'
261
+ * Location.legacyTzToTzid(-5, 'none'); // 'Etc/GMT-5'
243
262
  * @param tz integer, GMT offset in hours
244
263
  * @param dst 'none', 'eu', 'usa', or 'israel'
245
264
  */
@@ -299,9 +318,18 @@ export class Location extends GeoLocation {
299
318
  }
300
319
  }
301
320
  /**
302
- * Adds a location name for `Location.lookup()` only if the name isn't
303
- * already being used. Returns `false` if the name is already taken
304
- * and `true` if successfully added.
321
+ * Registers a new named location with the built-in `Location.lookup()`
322
+ * registry. Names are stored case-insensitively. Returns `false` if a
323
+ * location with the same (lower-cased) name is already registered, and
324
+ * `true` if successfully added.
325
+ *
326
+ * Use this to extend the built-in set of ~60 classic Hebcal cities with
327
+ * your own custom locations.
328
+ * @example
329
+ * const tlv = new Location(32.0853, 34.7818, true,
330
+ * 'Asia/Tel_Aviv', 'My Office, Tel Aviv', 'IL');
331
+ * Location.addLocation('My Office', tlv); // true
332
+ * Location.lookup('my office')?.getTzid(); // 'Asia/Tel_Aviv'
305
333
  */
306
334
  static addLocation(cityName, location) {
307
335
  const name = cityName.toLowerCase();
@@ -312,7 +340,3 @@ export class Location extends GeoLocation {
312
340
  return true;
313
341
  }
314
342
  }
315
- for (const city of classicCities0) {
316
- const location = new Location(city[2], city[3], city[1] === 'IL', city[4], city[0], city[1], undefined, city[5]);
317
- Location.addLocation(city[0], location);
318
- }
@@ -4,7 +4,20 @@ import { CalOptions } from './CalOptions';
4
4
  import { HDate } from '@hebcal/hdate';
5
5
  import './locale';
6
6
  /**
7
- * Represents a molad, the moment when the new moon is "born"
7
+ * Represents a *molad* the calculated moment when the new moon is "born"
8
+ * for a given Hebrew month.
9
+ *
10
+ * The molad is announced in synagogue on Shabbat Mevarchim (the Shabbat
11
+ * before Rosh Chodesh) and is the anchor point for Kiddush Levana zmanim.
12
+ * Calculations use the traditional chalakim arithmetic
13
+ * (1 hour = 1080 chalakim) anchored to *Molad Tohu BaHaRaD*.
14
+ *
15
+ * @example
16
+ * import {Molad, months} from '@hebcal/core';
17
+ * const m = new Molad(5784, months.NISAN);
18
+ * console.log(m.getMonthName()); // 'Nisan'
19
+ * console.log(m.getHour(), m.getMinutes(), m.getChalakim()); // e.g. 1 31 12
20
+ * console.log(m.render('en')); // 'Molad Nisan: Mon, 1:31am and 12 chalakim'
8
21
  */
9
22
  export declare class Molad {
10
23
  private readonly m;
@@ -12,9 +25,9 @@ export declare class Molad {
12
25
  private readonly month;
13
26
  private instant?;
14
27
  /**
15
- * Calculates the molad for a Hebrew month
16
- * @param year
17
- * @param month 1=NISSAN, 7=TISHREI
28
+ * Calculates the molad for a given Hebrew year and month.
29
+ * @param year Hebrew year
30
+ * @param month 1=NISAN, 7=TISHREI (uses Nisan-based numbering)
18
31
  */
19
32
  constructor(year: number, month: number);
20
33
  /**
@@ -56,12 +69,18 @@ export declare class Molad {
56
69
  */
57
70
  getChalakim(): number;
58
71
  /**
59
- * Returns the molad in Standard Time in Yerushalayim as a Temporal.ZonedDateTime.
72
+ * Returns the molad in Standard Time in Yerushalayim as a `Temporal.ZonedDateTime`.
60
73
  * This method subtracts 20.94 minutes (20 minutes and 56.496 seconds) from the computed time (Har Habayis with a longitude
61
74
  * of 35.2354&deg; is 5.2354&deg; away from the %15 timezone longitude) to get to standard time. This method
62
75
  * intentionally uses standard time and not daylight savings time.
63
76
  *
64
- * @return the Temporal.ZonedDateTime representing the moment of the molad in Yerushalayim standard time (GMT + 2)
77
+ * The returned value is cached after the first call.
78
+ * @example
79
+ * import {Molad, months} from '@hebcal/core';
80
+ * const m = new Molad(5784, months.NISAN);
81
+ * const zdt = m.getInstant();
82
+ * console.log(zdt.toString()); // e.g. '2024-04-08T17:21:13.333+00:00[UTC]'
83
+ * @return the `Temporal.ZonedDateTime` representing the moment of the molad
65
84
  */
66
85
  getInstant(): Temporal.ZonedDateTime;
67
86
  /**
@@ -109,8 +128,21 @@ export declare class Molad {
109
128
  */
110
129
  getSofZmanKidushLevana15Days(): Temporal.ZonedDateTime;
111
130
  /**
131
+ * Returns a human-readable, localized string announcing the molad —
132
+ * suitable for use on Shabbat Mevarchim. The format includes the Hebrew
133
+ * month name, day of week, hour : minute, and chalakim if non-zero.
134
+ *
135
+ * Time format honors `options.hour12` and `options.location` (12-hour vs.
136
+ * 24-hour); see {@link HebrewCalendar.reformatTimeStr}.
137
+ * @example
138
+ * import {Molad, months} from '@hebcal/core';
139
+ * const m = new Molad(5784, months.NISAN);
140
+ * m.render('en', {hour12: true});
141
+ * // => 'Molad Nisan: Mon, 7:21pm and 6 chalakim'
142
+ * m.render('he');
143
+ * // => 'מוֹלָד נִיסָן יִהְיֶה בַּיּוֹם שֵׁנִי בשָׁבוּעַ, …'
112
144
  * @param [locale] Optional locale name (defaults to empty locale)
113
- * @param options
145
+ * @param options used for time formatting (12-hour vs 24-hour)
114
146
  */
115
147
  render(locale?: string, options?: CalOptions): string;
116
148
  }
package/dist/src/molad.js CHANGED
@@ -54,7 +54,20 @@ function getHebrewTimeOfDay(hour) {
54
54
  return night;
55
55
  }
56
56
  /**
57
- * Represents a molad, the moment when the new moon is "born"
57
+ * Represents a *molad* the calculated moment when the new moon is "born"
58
+ * for a given Hebrew month.
59
+ *
60
+ * The molad is announced in synagogue on Shabbat Mevarchim (the Shabbat
61
+ * before Rosh Chodesh) and is the anchor point for Kiddush Levana zmanim.
62
+ * Calculations use the traditional chalakim arithmetic
63
+ * (1 hour = 1080 chalakim) anchored to *Molad Tohu BaHaRaD*.
64
+ *
65
+ * @example
66
+ * import {Molad, months} from '@hebcal/core';
67
+ * const m = new Molad(5784, months.NISAN);
68
+ * console.log(m.getMonthName()); // 'Nisan'
69
+ * console.log(m.getHour(), m.getMinutes(), m.getChalakim()); // e.g. 1 31 12
70
+ * console.log(m.render('en')); // 'Molad Nisan: Mon, 1:31am and 12 chalakim'
58
71
  */
59
72
  export class Molad {
60
73
  m;
@@ -62,9 +75,9 @@ export class Molad {
62
75
  month;
63
76
  instant;
64
77
  /**
65
- * Calculates the molad for a Hebrew month
66
- * @param year
67
- * @param month 1=NISSAN, 7=TISHREI
78
+ * Calculates the molad for a given Hebrew year and month.
79
+ * @param year Hebrew year
80
+ * @param month 1=NISAN, 7=TISHREI (uses Nisan-based numbering)
68
81
  */
69
82
  constructor(year, month) {
70
83
  this.m = calculateMolad(year, month);
@@ -126,12 +139,18 @@ export class Molad {
126
139
  return this.m.chalakim;
127
140
  }
128
141
  /**
129
- * Returns the molad in Standard Time in Yerushalayim as a Temporal.ZonedDateTime.
142
+ * Returns the molad in Standard Time in Yerushalayim as a `Temporal.ZonedDateTime`.
130
143
  * This method subtracts 20.94 minutes (20 minutes and 56.496 seconds) from the computed time (Har Habayis with a longitude
131
144
  * of 35.2354&deg; is 5.2354&deg; away from the %15 timezone longitude) to get to standard time. This method
132
145
  * intentionally uses standard time and not daylight savings time.
133
146
  *
134
- * @return the Temporal.ZonedDateTime representing the moment of the molad in Yerushalayim standard time (GMT + 2)
147
+ * The returned value is cached after the first call.
148
+ * @example
149
+ * import {Molad, months} from '@hebcal/core';
150
+ * const m = new Molad(5784, months.NISAN);
151
+ * const zdt = m.getInstant();
152
+ * console.log(zdt.toString()); // e.g. '2024-04-08T17:21:13.333+00:00[UTC]'
153
+ * @return the `Temporal.ZonedDateTime` representing the moment of the molad
135
154
  */
136
155
  getInstant() {
137
156
  this.instant ??= getMoladAsDate(this.m);
@@ -203,8 +222,21 @@ export class Molad {
203
222
  return zdt.add({ hours: 24 * 15 });
204
223
  }
205
224
  /**
225
+ * Returns a human-readable, localized string announcing the molad —
226
+ * suitable for use on Shabbat Mevarchim. The format includes the Hebrew
227
+ * month name, day of week, hour : minute, and chalakim if non-zero.
228
+ *
229
+ * Time format honors `options.hour12` and `options.location` (12-hour vs.
230
+ * 24-hour); see {@link HebrewCalendar.reformatTimeStr}.
231
+ * @example
232
+ * import {Molad, months} from '@hebcal/core';
233
+ * const m = new Molad(5784, months.NISAN);
234
+ * m.render('en', {hour12: true});
235
+ * // => 'Molad Nisan: Mon, 7:21pm and 6 chalakim'
236
+ * m.render('he');
237
+ * // => 'מוֹלָד נִיסָן יִהְיֶה בַּיּוֹם שֵׁנִי בשָׁבוּעַ, …'
206
238
  * @param [locale] Optional locale name (defaults to empty locale)
207
- * @param options
239
+ * @param options used for time formatting (12-hour vs 24-hour)
208
240
  */
209
241
  render(locale, options) {
210
242
  const monthName = Locale.gettext(this.getMonthName(), locale);
@@ -6,21 +6,49 @@ import './locale';
6
6
  * Lang for the Sefira can be English, Hebrew, or Hebrew in Sephardic transliteration.
7
7
  */
8
8
  export type OmerLang = 'en' | 'he' | 'translit';
9
- /** Represents a day 1-49 of counting the Omer from Pesach to Shavuot */
9
+ /**
10
+ * Represents one of the 49 days of counting the Omer between Pesach and
11
+ * Shavuot (16 Nisan through 5 Sivan).
12
+ *
13
+ * Each day has an associated Sefirah pairing (e.g. *Chesed shebiGevurah*),
14
+ * a word from Psalm 67 (Lamnatzeach), a letter from verse 5 of Psalm 67,
15
+ * and a word/acrostic from the Ana BeKoach prayer — all accessible via
16
+ * the methods on this class.
17
+ *
18
+ * @example
19
+ * import {OmerEvent, HDate, months} from '@hebcal/core';
20
+ * const ev = new OmerEvent(new HDate(16, months.NISAN, 5784), 1);
21
+ * ev.render('en'); // '1st day of the Omer'
22
+ * ev.render('he'); // 'א׳ בָּעוֹמֶר'
23
+ * ev.sefira('translit'); // 'Chesed shebChesed'
24
+ * ev.getTodayIs('en'); // 'Today is 1 day of the Omer'
25
+ */
10
26
  export declare class OmerEvent extends Event {
11
27
  private readonly weekNumber;
12
28
  private readonly daysWithinWeeks;
13
29
  readonly omer: number;
14
30
  /**
15
- * @param date
16
- * @param omerDay
31
+ * Constructs an Omer event for a given day (1–49).
32
+ *
33
+ * Throws `RangeError` if `omerDay` is outside 1–49.
34
+ * @param date Hebrew date this Omer day is counted on (the evening of)
35
+ * @param omerDay day of the Omer, 1 through 49
17
36
  */
18
37
  constructor(date: HDate, omerDay: number);
19
38
  /**
20
- * Returns the sefira. For example, on day 8:
39
+ * Returns the Sefirah pairing associated with this Omer day
40
+ * one of the seven lower Sefirot within another, calculated as
41
+ * `day-within-week` of `week-within-cycle`. For example, on day 8
42
+ * (week 2, day 1):
21
43
  * * חֶֽסֶד שֶׁבִּגְבוּרָה
22
44
  * * Chesed shebiGevurah
23
45
  * * Lovingkindness within Might
46
+ * @example
47
+ * import {OmerEvent, HDate, months} from '@hebcal/core';
48
+ * const day8 = new OmerEvent(new HDate(23, months.NISAN, 5784), 8);
49
+ * day8.sefira('en'); // 'Lovingkindness within Might'
50
+ * day8.sefira('he'); // 'חֶֽסֶד שֶׁבִּגְבוּרָה'
51
+ * day8.sefira('translit'); // 'Chesed shebiGevurah'
24
52
  * @param lang `en` (English), `he` (Hebrew with nikud), or `translit` (Hebrew in Sephardic transliteration)
25
53
  * @returns a string such as `Lovingkindness within Might` or `חֶֽסֶד שֶׁבִּגְבוּרָה`
26
54
  */
package/dist/src/omer.js CHANGED
@@ -188,14 +188,33 @@ const anaBekoach = sefira.anaBekoach;
188
188
  const ps67lines = sefira.ps67lines;
189
189
  const lamnatzeach = ps67lines.flatMap((x) => x.split(/[ ־]/));
190
190
  const lamnatzeachLetters = sefira.lamnatzeachLetters.split('');
191
- /** Represents a day 1-49 of counting the Omer from Pesach to Shavuot */
191
+ /**
192
+ * Represents one of the 49 days of counting the Omer between Pesach and
193
+ * Shavuot (16 Nisan through 5 Sivan).
194
+ *
195
+ * Each day has an associated Sefirah pairing (e.g. *Chesed shebiGevurah*),
196
+ * a word from Psalm 67 (Lamnatzeach), a letter from verse 5 of Psalm 67,
197
+ * and a word/acrostic from the Ana BeKoach prayer — all accessible via
198
+ * the methods on this class.
199
+ *
200
+ * @example
201
+ * import {OmerEvent, HDate, months} from '@hebcal/core';
202
+ * const ev = new OmerEvent(new HDate(16, months.NISAN, 5784), 1);
203
+ * ev.render('en'); // '1st day of the Omer'
204
+ * ev.render('he'); // 'א׳ בָּעוֹמֶר'
205
+ * ev.sefira('translit'); // 'Chesed shebChesed'
206
+ * ev.getTodayIs('en'); // 'Today is 1 day of the Omer'
207
+ */
192
208
  export class OmerEvent extends Event {
193
209
  weekNumber;
194
210
  daysWithinWeeks;
195
211
  omer;
196
212
  /**
197
- * @param date
198
- * @param omerDay
213
+ * Constructs an Omer event for a given day (1–49).
214
+ *
215
+ * Throws `RangeError` if `omerDay` is outside 1–49.
216
+ * @param date Hebrew date this Omer day is counted on (the evening of)
217
+ * @param omerDay day of the Omer, 1 through 49
199
218
  */
200
219
  constructor(date, omerDay) {
201
220
  super(date, `Omer ${omerDay}`, flags.OMER_COUNT);
@@ -205,10 +224,19 @@ export class OmerEvent extends Event {
205
224
  this.omer = omerDay;
206
225
  }
207
226
  /**
208
- * Returns the sefira. For example, on day 8:
227
+ * Returns the Sefirah pairing associated with this Omer day
228
+ * one of the seven lower Sefirot within another, calculated as
229
+ * `day-within-week` of `week-within-cycle`. For example, on day 8
230
+ * (week 2, day 1):
209
231
  * * חֶֽסֶד שֶׁבִּגְבוּרָה
210
232
  * * Chesed shebiGevurah
211
233
  * * Lovingkindness within Might
234
+ * @example
235
+ * import {OmerEvent, HDate, months} from '@hebcal/core';
236
+ * const day8 = new OmerEvent(new HDate(23, months.NISAN, 5784), 8);
237
+ * day8.sefira('en'); // 'Lovingkindness within Might'
238
+ * day8.sefira('he'); // 'חֶֽסֶד שֶׁבִּגְבוּרָה'
239
+ * day8.sefira('translit'); // 'Chesed shebiGevurah'
212
240
  * @param lang `en` (English), `he` (Hebrew with nikud), or `translit` (Hebrew in Sephardic transliteration)
213
241
  * @returns a string such as `Lovingkindness within Might` or `חֶֽסֶד שֶׁבִּגְבוּרָה`
214
242
  */
@@ -1,6 +1,17 @@
1
1
  import { ParshaEvent } from './ParshaEvent';
2
2
  /**
3
- * Calculates weekly Torah Reading on Saturdays for entire year
3
+ * Calculates the weekly Torah Reading (Parashat HaShavua) on Saturdays for
4
+ * an entire Hebrew year.
5
+ *
6
+ * Saturdays on which a Yom Tov reading displaces the regular parsha
7
+ * (e.g. Shabbat Chol ha-Moed Pesach/Sukkot, Yom Kippur on Shabbat) are
8
+ * skipped — for those use {@link getHolidaysOnDate} or
9
+ * {@link Sedra.lookup}.
10
+ * @example
11
+ * import {parshaYear} from '@hebcal/core';
12
+ * const events = parshaYear(5784, false);
13
+ * events[0].render('en'); // 'Parashat Vayeilech'
14
+ * events[0].getDate().toString(); // '4 Tishrei 5784'
4
15
  * @param year Hebrew year
5
16
  * @param il Israel (false for Diaspora)
6
17
  * @returns an array of `ParshaEvent` occurring on Saturdays that contain a regular
@@ -2,7 +2,18 @@ import { HDate, months } from '@hebcal/hdate';
2
2
  import { ParshaEvent } from './ParshaEvent';
3
3
  import { getSedra } from './sedra';
4
4
  /**
5
- * Calculates weekly Torah Reading on Saturdays for entire year
5
+ * Calculates the weekly Torah Reading (Parashat HaShavua) on Saturdays for
6
+ * an entire Hebrew year.
7
+ *
8
+ * Saturdays on which a Yom Tov reading displaces the regular parsha
9
+ * (e.g. Shabbat Chol ha-Moed Pesach/Sukkot, Yom Kippur on Shabbat) are
10
+ * skipped — for those use {@link getHolidaysOnDate} or
11
+ * {@link Sedra.lookup}.
12
+ * @example
13
+ * import {parshaYear} from '@hebcal/core';
14
+ * const events = parshaYear(5784, false);
15
+ * events[0].render('en'); // 'Parashat Vayeilech'
16
+ * events[0].getDate().toString(); // '4 Tishrei 5784'
6
17
  * @param year Hebrew year
7
18
  * @param il Israel (false for Diaspora)
8
19
  * @returns an array of `ParshaEvent` occurring on Saturdays that contain a regular
@@ -1,2 +1,2 @@
1
1
  /** DO NOT EDIT THIS AUTO-GENERATED FILE! */
2
- export declare const version = "6.5.0";
2
+ export declare const version = "6.5.2";
@@ -1,2 +1,2 @@
1
1
  /** DO NOT EDIT THIS AUTO-GENERATED FILE! */
2
- export const version = '6.5.0';
2
+ export const version = '6.5.2';