@hebcal/core 6.5.1 → 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.
- package/dist/bundle.js +5929 -5384
- package/dist/bundle.js.map +1 -1
- package/dist/bundle.min.js +17 -17
- package/dist/bundle.min.js.map +1 -1
- package/dist/esm/CalOptions.d.ts +3 -4
- package/dist/esm/DailyLearning.d.ts +44 -7
- package/dist/esm/DailyLearning.js +45 -8
- package/dist/esm/DailyLearning.js.map +1 -1
- package/dist/esm/HebrewDateEvent.js +1 -1
- package/dist/esm/HolidayEvent.d.ts +34 -1
- package/dist/esm/HolidayEvent.js +35 -2
- package/dist/esm/HolidayEvent.js.map +1 -1
- package/dist/esm/MevarchimChodeshEvent.js +1 -1
- package/dist/esm/ParshaEvent.js +1 -1
- package/dist/esm/TimedEvent.d.ts +32 -3
- package/dist/esm/TimedEvent.js +33 -4
- package/dist/esm/TimedEvent.js.map +1 -1
- package/dist/esm/YomKippurKatanEvent.js +1 -1
- package/dist/esm/ashkenazi.po.js +1 -1
- package/dist/esm/calendar.js +1 -1
- package/dist/esm/candles.d.ts +14 -1
- package/dist/esm/candles.js +15 -2
- package/dist/esm/candles.js.map +1 -1
- package/dist/esm/cities.json.js +1 -1
- package/dist/esm/event.d.ts +56 -13
- package/dist/esm/event.js +57 -14
- package/dist/esm/event.js.map +1 -1
- package/dist/esm/getStartAndEnd.js +10 -2
- package/dist/esm/getStartAndEnd.js.map +1 -1
- package/dist/esm/hallel.js +20 -28
- package/dist/esm/hallel.js.map +1 -1
- package/dist/esm/he-x-NoNikud.po.js +1 -1
- package/dist/esm/he.po.js +1 -1
- package/dist/esm/hebcal.d.ts +97 -19
- package/dist/esm/hebcal.js +102 -21
- package/dist/esm/hebcal.js.map +1 -1
- package/dist/esm/holidays.d.ts +21 -2
- package/dist/esm/holidays.js +22 -3
- package/dist/esm/holidays.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/isAssurBemlacha.d.ts +24 -4
- package/dist/esm/isAssurBemlacha.js +25 -5
- package/dist/esm/isAssurBemlacha.js.map +1 -1
- package/dist/esm/isAveilut.d.ts +14 -3
- package/dist/esm/isAveilut.js +15 -4
- package/dist/esm/isAveilut.js.map +1 -1
- package/dist/esm/isFastDay.d.ts +13 -1
- package/dist/esm/isFastDay.js +14 -2
- package/dist/esm/isFastDay.js.map +1 -1
- package/dist/esm/locale.js +1 -1
- package/dist/esm/location.d.ts +96 -8
- package/dist/esm/location.js +101 -10
- package/dist/esm/location.js.map +1 -1
- package/dist/esm/modern.js +1 -1
- package/dist/esm/molad.d.ts +39 -7
- package/dist/esm/molad.js +40 -8
- package/dist/esm/molad.js.map +1 -1
- package/dist/esm/moladBase.js +1 -1
- package/dist/esm/moladDate.js +1 -1
- package/dist/esm/omer.d.ts +32 -4
- package/dist/esm/omer.js +33 -5
- package/dist/esm/omer.js.map +1 -1
- package/dist/esm/parshaName.js +1 -1
- package/dist/esm/parshaYear.d.ts +12 -1
- package/dist/esm/parshaYear.js +13 -2
- package/dist/esm/parshaYear.js.map +1 -1
- package/dist/esm/pkgVersion.d.ts +1 -1
- package/dist/esm/pkgVersion.js +2 -2
- package/dist/esm/pkgVersion.js.map +1 -1
- package/dist/esm/reformatTimeStr.js +1 -1
- package/dist/esm/sedra.d.ts +94 -14
- package/dist/esm/sedra.js +95 -15
- package/dist/esm/sedra.js.map +1 -1
- package/dist/esm/sefira.json.js +1 -1
- package/dist/esm/staticHolidays.js +1 -1
- package/dist/esm/tachanun.js +1 -1
- package/dist/esm/temporal-shim.js +1 -1
- package/dist/esm/zmanim.js +1 -1
- package/dist/src/CalOptions.d.ts +3 -4
- package/dist/src/DailyLearning.d.ts +44 -7
- package/dist/src/DailyLearning.js +44 -7
- package/dist/src/HolidayEvent.d.ts +34 -1
- package/dist/src/HolidayEvent.js +34 -1
- package/dist/src/TimedEvent.d.ts +32 -3
- package/dist/src/TimedEvent.js +32 -3
- package/dist/src/candles.d.ts +14 -1
- package/dist/src/candles.js +14 -1
- package/dist/src/event.d.ts +56 -13
- package/dist/src/event.js +56 -13
- package/dist/src/getStartAndEnd.js +9 -1
- package/dist/src/hallel.js +19 -27
- package/dist/src/hebcal.d.ts +97 -19
- package/dist/src/hebcal.js +101 -20
- package/dist/src/holidays.d.ts +21 -2
- package/dist/src/holidays.js +21 -2
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/isAssurBemlacha.d.ts +24 -4
- package/dist/src/isAssurBemlacha.js +24 -4
- package/dist/src/isAveilut.d.ts +14 -3
- package/dist/src/isAveilut.js +14 -3
- package/dist/src/isFastDay.d.ts +13 -1
- package/dist/src/isFastDay.js +13 -1
- package/dist/src/location.d.ts +96 -8
- package/dist/src/location.js +100 -9
- package/dist/src/molad.d.ts +39 -7
- package/dist/src/molad.js +39 -7
- package/dist/src/omer.d.ts +32 -4
- package/dist/src/omer.js +32 -4
- package/dist/src/parshaYear.d.ts +12 -1
- package/dist/src/parshaYear.js +12 -1
- package/dist/src/pkgVersion.d.ts +1 -1
- package/dist/src/pkgVersion.js +1 -1
- package/dist/src/sedra.d.ts +94 -14
- package/dist/src/sedra.js +94 -14
- package/package.json +5 -5
package/dist/src/location.js
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import { GeoLocation } from '@hebcal/noaa';
|
|
22
22
|
import citiesJson from './cities.json';
|
|
23
|
+
import QuickLRU from 'quick-lru';
|
|
23
24
|
const classicCities = new Map();
|
|
24
25
|
// Zip-Codes.com TimeZone IDs
|
|
25
26
|
const ZIPCODES_TZ_MAP = {
|
|
@@ -38,7 +39,9 @@ const ZIPCODES_TZ_MAP = {
|
|
|
38
39
|
'16': 'Pacific/Chuuk', // Micronesia (GMT +11:00)
|
|
39
40
|
};
|
|
40
41
|
/** @private */
|
|
41
|
-
const timeFormatCache = new
|
|
42
|
+
const timeFormatCache = new QuickLRU({
|
|
43
|
+
maxSize: 120,
|
|
44
|
+
});
|
|
42
45
|
/**
|
|
43
46
|
* Gets a 24-hour time formatter (e.g. 07:41 or 20:03) from cache
|
|
44
47
|
* or makes a new one if needed
|
|
@@ -64,7 +67,31 @@ function initClassicCities() {
|
|
|
64
67
|
Location.addLocation(cityName, location);
|
|
65
68
|
}
|
|
66
69
|
}
|
|
67
|
-
/**
|
|
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
|
+
*/
|
|
68
95
|
export class Location extends GeoLocation {
|
|
69
96
|
il;
|
|
70
97
|
cc;
|
|
@@ -107,14 +134,31 @@ export class Location extends GeoLocation {
|
|
|
107
134
|
this.cc = countryCode;
|
|
108
135
|
this.geoid = geoid;
|
|
109
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
|
+
*/
|
|
110
141
|
getIsrael() {
|
|
111
142
|
return this.il;
|
|
112
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
|
+
*/
|
|
113
150
|
getName() {
|
|
114
151
|
return this.getLocationName();
|
|
115
152
|
}
|
|
116
153
|
/**
|
|
117
|
-
* Returns the location name
|
|
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'
|
|
118
162
|
*/
|
|
119
163
|
getShortName() {
|
|
120
164
|
const name = this.getLocationName();
|
|
@@ -133,18 +177,37 @@ export class Location extends GeoLocation {
|
|
|
133
177
|
}
|
|
134
178
|
return name.substring(0, comma);
|
|
135
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
|
+
*/
|
|
136
184
|
getCountryCode() {
|
|
137
185
|
return this.cc;
|
|
138
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* Returns the Olson timezone identifier (e.g. `"America/Chicago"`).
|
|
189
|
+
* Alias for `getTimeZone()` from the parent `GeoLocation` class.
|
|
190
|
+
*/
|
|
139
191
|
getTzid() {
|
|
140
192
|
return this.getTimeZone();
|
|
141
193
|
}
|
|
142
194
|
/**
|
|
143
|
-
*
|
|
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'
|
|
144
202
|
*/
|
|
145
203
|
getTimeFormatter() {
|
|
146
204
|
return getFormatter(this.getTimeZone());
|
|
147
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
|
+
*/
|
|
148
211
|
getGeoId() {
|
|
149
212
|
return this.geoid;
|
|
150
213
|
}
|
|
@@ -164,7 +227,13 @@ export class Location extends GeoLocation {
|
|
|
164
227
|
* 'San Diego', 'San Francisco', 'Sao Paulo', 'Seattle', 'Sydney',
|
|
165
228
|
* 'Tel Aviv', 'Tiberias', 'Toronto', 'Vancouver', 'White Plains',
|
|
166
229
|
* 'Washington DC', 'Worcester'
|
|
167
|
-
*
|
|
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
|
|
168
237
|
*/
|
|
169
238
|
static lookup(name) {
|
|
170
239
|
if (classicCities.size === 0) {
|
|
@@ -172,11 +241,24 @@ export class Location extends GeoLocation {
|
|
|
172
241
|
}
|
|
173
242
|
return classicCities.get(name.toLowerCase());
|
|
174
243
|
}
|
|
244
|
+
/**
|
|
245
|
+
* Returns a JSON-serialized representation of this Location.
|
|
246
|
+
* Useful for debugging and structured logging.
|
|
247
|
+
*/
|
|
175
248
|
toString() {
|
|
176
249
|
return JSON.stringify(this);
|
|
177
250
|
}
|
|
178
251
|
/**
|
|
179
|
-
* Converts legacy Hebcal timezone
|
|
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'
|
|
180
262
|
* @param tz integer, GMT offset in hours
|
|
181
263
|
* @param dst 'none', 'eu', 'usa', or 'israel'
|
|
182
264
|
*/
|
|
@@ -236,9 +318,18 @@ export class Location extends GeoLocation {
|
|
|
236
318
|
}
|
|
237
319
|
}
|
|
238
320
|
/**
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
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'
|
|
242
333
|
*/
|
|
243
334
|
static addLocation(cityName, location) {
|
|
244
335
|
const name = cityName.toLowerCase();
|
package/dist/src/molad.d.ts
CHANGED
|
@@ -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
|
|
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=
|
|
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° is 5.2354° 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
|
-
*
|
|
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
|
|
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=
|
|
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° is 5.2354° 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
|
-
*
|
|
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);
|
package/dist/src/omer.d.ts
CHANGED
|
@@ -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
|
-
/**
|
|
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
|
-
*
|
|
16
|
-
*
|
|
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
|
|
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
|
-
/**
|
|
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
|
-
*
|
|
198
|
-
*
|
|
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
|
|
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
|
*/
|
package/dist/src/parshaYear.d.ts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { ParshaEvent } from './ParshaEvent';
|
|
2
2
|
/**
|
|
3
|
-
* Calculates weekly Torah Reading on Saturdays for
|
|
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
|
package/dist/src/parshaYear.js
CHANGED
|
@@ -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
|
|
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
|
package/dist/src/pkgVersion.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** DO NOT EDIT THIS AUTO-GENERATED FILE! */
|
|
2
|
-
export declare const version = "6.5.
|
|
2
|
+
export declare const version = "6.5.2";
|
package/dist/src/pkgVersion.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** DO NOT EDIT THIS AUTO-GENERATED FILE! */
|
|
2
|
-
export const version = '6.5.
|
|
2
|
+
export const version = '6.5.2';
|
package/dist/src/sedra.d.ts
CHANGED
|
@@ -27,7 +27,23 @@ export type SedraResult = {
|
|
|
27
27
|
il: boolean;
|
|
28
28
|
};
|
|
29
29
|
/**
|
|
30
|
-
* Represents
|
|
30
|
+
* Represents the weekly Torah-reading (Parashat HaShavua) schedule for an
|
|
31
|
+
* entire Hebrew year.
|
|
32
|
+
*
|
|
33
|
+
* The schedule depends on the year's *keviyah* — the day of week of Rosh
|
|
34
|
+
* Hashana, whether the year is leap, whether Cheshvan/Kislev are long or
|
|
35
|
+
* short, and whether the schedule is for Israel or the Diaspora (since
|
|
36
|
+
* Israel and the Diaspora diverge in some years when the 8th day of Pesach
|
|
37
|
+
* or the 2nd day of Shavuot fall on Shabbat).
|
|
38
|
+
*
|
|
39
|
+
* Prefer {@link getSedra} (or {@link HebrewCalendar.getSedra}) over
|
|
40
|
+
* calling this constructor directly, since both cache their results.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* import {Sedra, HDate, months} from '@hebcal/core';
|
|
44
|
+
* const sedra = new Sedra(5784, false);
|
|
45
|
+
* const result = sedra.lookup(new HDate(15, months.CHESHVAN, 5784));
|
|
46
|
+
* console.log(result.parsha); // ['Lech-Lecha']
|
|
31
47
|
*/
|
|
32
48
|
export declare class Sedra {
|
|
33
49
|
private readonly year;
|
|
@@ -37,14 +53,29 @@ export declare class Sedra {
|
|
|
37
53
|
private readonly theSedraArray;
|
|
38
54
|
private readonly yearKey;
|
|
39
55
|
/**
|
|
40
|
-
*
|
|
56
|
+
* Calculates the Parashat HaShavua schedule for an entire Hebrew year.
|
|
41
57
|
* @param hyear - Hebrew year (e.g. 5749)
|
|
42
58
|
* @param il - Use Israel sedra schedule (false for Diaspora)
|
|
43
59
|
*/
|
|
44
60
|
constructor(hyear: number, il: boolean);
|
|
45
61
|
/**
|
|
46
|
-
* Returns the date
|
|
47
|
-
*
|
|
62
|
+
* Returns the date a parsha is read this year, or `null` if it does not
|
|
63
|
+
* occur in this year's schedule.
|
|
64
|
+
*
|
|
65
|
+
* A doubled parsha (e.g. `'Matot-Masei'`) will only return a date in years
|
|
66
|
+
* where that pair is actually read together; in years where they are read
|
|
67
|
+
* separately, this returns `null`. Use {@link findContaining} to find the
|
|
68
|
+
* date a parsha is read regardless of whether it is doubled.
|
|
69
|
+
*
|
|
70
|
+
* Throws `RangeError` for an out-of-range numeric input or an invalid
|
|
71
|
+
* doubled-parsha pair, and `TypeError` for a malformed array argument.
|
|
72
|
+
* @example
|
|
73
|
+
* import {Sedra} from '@hebcal/core';
|
|
74
|
+
* const sedra = new Sedra(5784, false);
|
|
75
|
+
* sedra.find('Noach')?.toString(); // '15 Cheshvan 5784'
|
|
76
|
+
* sedra.find(1)?.toString(); // same, by 0-based index
|
|
77
|
+
* sedra.find('Matot-Masei')?.toString(); // null in 5784 — read separately
|
|
78
|
+
* sedra.find(['Matot', 'Masei']); // also null in 5784
|
|
48
79
|
* @param parsha if a `string`, specified with Sephardic transliterations
|
|
49
80
|
* like `'Noach'` or `'Matot-Masei'`. If an array, must be a 1- or 2-element
|
|
50
81
|
* array such as `['Noach']` or `['Matot', 'Masei']`. If a `number`, should
|
|
@@ -54,22 +85,63 @@ export declare class Sedra {
|
|
|
54
85
|
find(parsha: number | string | string[]): HDate | null;
|
|
55
86
|
private findInternal;
|
|
56
87
|
/**
|
|
57
|
-
* Returns the date
|
|
58
|
-
*
|
|
88
|
+
* Returns the date a parsha is read this year, looking through both
|
|
89
|
+
* single and doubled forms.
|
|
90
|
+
*
|
|
91
|
+
* For example, if `'Matot'` is read individually this year, this returns
|
|
92
|
+
* its date; if it is read as part of `'Matot-Masei'` this year, this
|
|
93
|
+
* returns the date of `'Matot-Masei'` (and similarly for `'Masei'`).
|
|
94
|
+
* Conversely, asking for `'Matot-Masei'` in a year where they are split
|
|
95
|
+
* will return the date of `'Matot'` alone.
|
|
96
|
+
* @example
|
|
97
|
+
* import {Sedra} from '@hebcal/core';
|
|
98
|
+
* const sedra = new Sedra(5784, false);
|
|
99
|
+
* // Matot-Masei is split in 5784; both individual halves resolve:
|
|
100
|
+
* sedra.findContaining('Matot')?.toString(); // '22 Tamuz 5784'
|
|
101
|
+
* sedra.findContaining('Masei')?.toString(); // '29 Tamuz 5784'
|
|
102
|
+
* // Asking for the doubled name returns the date of the first half:
|
|
103
|
+
* sedra.findContaining('Matot-Masei')?.toString(); // '22 Tamuz 5784'
|
|
59
104
|
*/
|
|
60
105
|
findContaining(parsha: number | string): HDate | null;
|
|
61
106
|
/**
|
|
62
|
-
* Returns the underlying annual
|
|
63
|
-
*
|
|
107
|
+
* Returns the underlying annual reading schedule as an array, where each
|
|
108
|
+
* entry corresponds to one Saturday (starting from the first Shabbat on
|
|
109
|
+
* or after Rosh Hashana). Entries are either:
|
|
110
|
+
* - a non-negative `number`: a 0-based parsha index (e.g. `0` for
|
|
111
|
+
* *Bereshit*)
|
|
112
|
+
* - a negative `number`: the negated first index of a doubled parsha
|
|
113
|
+
* (e.g. `-21` for *Vayakhel-Pekudei*)
|
|
114
|
+
* - a `string`: a holiday name when a Yom Tov displaces the weekly reading
|
|
115
|
+
* (e.g. `'Pesach Shabbat Chol ha-Moed'`, `'Yom Kippur'`)
|
|
116
|
+
*
|
|
117
|
+
* Used by `@hebcal/triennial`.
|
|
64
118
|
*/
|
|
65
119
|
getSedraArray(): readonly NumberOrString[];
|
|
66
120
|
/**
|
|
67
|
-
* R.D.
|
|
121
|
+
* Returns the R.D. (Rata Die / Fixed Date) absolute day number of the
|
|
122
|
+
* first Saturday on or after Rosh Hashana of this year. This is the
|
|
123
|
+
* anchor point for {@link getSedraArray} — index `0` of that array
|
|
124
|
+
* corresponds to this date.
|
|
68
125
|
*/
|
|
69
126
|
getFirstSaturday(): number;
|
|
127
|
+
/** Returns the Hebrew year this `Sedra` instance covers. */
|
|
70
128
|
getYear(): number;
|
|
71
129
|
/**
|
|
72
|
-
* Returns
|
|
130
|
+
* Returns details about the parsha read on the first Saturday on or after
|
|
131
|
+
* `hd`. If `hd` is itself a Saturday, the reading for that date is
|
|
132
|
+
* returned; otherwise the reading for the upcoming Saturday is returned.
|
|
133
|
+
*
|
|
134
|
+
* If the given date falls in the final days of the Hebrew year (after
|
|
135
|
+
* the last reading of this year's schedule), this method transparently
|
|
136
|
+
* delegates to the next year's `Sedra`.
|
|
137
|
+
* @example
|
|
138
|
+
* import {Sedra, HDate, months} from '@hebcal/core';
|
|
139
|
+
* const sedra = new Sedra(5784, false);
|
|
140
|
+
* // A weekday — returns the upcoming Shabbat's reading
|
|
141
|
+
* const result = sedra.lookup(new HDate(13, months.CHESHVAN, 5784));
|
|
142
|
+
* console.log(result.parsha); // ['Lech-Lecha']
|
|
143
|
+
* console.log(result.chag); // false
|
|
144
|
+
* console.log(result.hdate.toString()); // '15 Cheshvan 5784' (Saturday)
|
|
73
145
|
* @param hd Hebrew date or R.D. days
|
|
74
146
|
*/
|
|
75
147
|
lookup(hd: HDate | number): SedraResult;
|
|
@@ -86,10 +158,18 @@ export declare class Sedra {
|
|
|
86
158
|
export declare const parshiot: readonly string[];
|
|
87
159
|
type NumberOrString = number | string;
|
|
88
160
|
/**
|
|
89
|
-
* Convenience function to create an instance of
|
|
90
|
-
* created and cached instance.
|
|
91
|
-
*
|
|
92
|
-
*
|
|
161
|
+
* Convenience function to create an instance of {@link Sedra} or reuse a
|
|
162
|
+
* previously created and cached instance for the same year and schedule.
|
|
163
|
+
*
|
|
164
|
+
* Prefer this over `new Sedra(...)` when calling repeatedly — an internal
|
|
165
|
+
* LRU cache (~120 entries) avoids recomputing the keviyah-specific schedule.
|
|
166
|
+
* @example
|
|
167
|
+
* import {getSedra, HDate, months} from '@hebcal/core';
|
|
168
|
+
* const sedra = getSedra(5784, false);
|
|
169
|
+
* const {parsha} = sedra.lookup(new HDate(15, months.CHESHVAN, 5784));
|
|
170
|
+
* console.log(parsha); // ['Lech-Lecha']
|
|
171
|
+
* @param hyear Hebrew year
|
|
172
|
+
* @param il Use Israel sedra schedule (`false` for Diaspora)
|
|
93
173
|
*/
|
|
94
174
|
export declare function getSedra(hyear: number, il: boolean): Sedra;
|
|
95
175
|
export {};
|