@hebcal/core 6.11.1 → 6.13.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.
- package/dist/bundle.js +1681 -1915
- package/dist/bundle.js.map +1 -1
- package/dist/bundle.min.js +18 -19
- package/dist/bundle.min.js.map +1 -1
- package/dist/esm/DailyLearning.js +5 -15
- package/dist/esm/DailyLearning.js.map +1 -1
- package/dist/esm/HebrewDateEvent.d.ts +0 -4
- package/dist/esm/HebrewDateEvent.js +2 -6
- package/dist/esm/HebrewDateEvent.js.map +1 -1
- package/dist/esm/HolidayEvent.js +6 -10
- package/dist/esm/HolidayEvent.js.map +1 -1
- package/dist/esm/MevarchimChodeshEvent.js +2 -2
- package/dist/esm/MevarchimChodeshEvent.js.map +1 -1
- package/dist/esm/ParshaEvent.js +4 -4
- package/dist/esm/ParshaEvent.js.map +1 -1
- package/dist/esm/TimedEvent.js +4 -5
- package/dist/esm/TimedEvent.js.map +1 -1
- package/dist/esm/YomKippurKatanEvent.js +2 -2
- package/dist/esm/YomKippurKatanEvent.js.map +1 -1
- package/dist/esm/ashkenazi.po.js +1 -1
- package/dist/esm/calendar.js +7 -40
- package/dist/esm/calendar.js.map +1 -1
- package/dist/esm/candles.d.ts +3 -5
- package/dist/esm/candles.js +6 -20
- package/dist/esm/candles.js.map +1 -1
- package/dist/esm/cities.json.js +1 -1
- package/dist/esm/event.js +4 -6
- package/dist/esm/event.js.map +1 -1
- package/dist/esm/getStartAndEnd.d.ts +1 -1
- package/dist/esm/getStartAndEnd.js +8 -9
- package/dist/esm/getStartAndEnd.js.map +1 -1
- package/dist/esm/hallel.d.ts +1 -3
- package/dist/esm/hallel.js +2 -4
- package/dist/esm/hallel.js.map +1 -1
- package/dist/esm/he-x-NoNikud.po.d.ts +1 -0
- package/dist/esm/he-x-NoNikud.po.js +2 -2
- package/dist/esm/he-x-NoNikud.po.js.map +1 -1
- package/dist/esm/he.po.d.ts +1 -0
- package/dist/esm/he.po.js +2 -2
- package/dist/esm/he.po.js.map +1 -1
- package/dist/esm/hebcal.js +6 -12
- package/dist/esm/hebcal.js.map +1 -1
- package/dist/esm/holidays.d.ts +1 -1
- package/dist/esm/holidays.js +111 -131
- package/dist/esm/holidays.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/isAssurBemlacha.js +5 -18
- package/dist/esm/isAssurBemlacha.js.map +1 -1
- package/dist/esm/isAveilut.js +2 -5
- package/dist/esm/isAveilut.js.map +1 -1
- package/dist/esm/isFastDay.js +3 -4
- package/dist/esm/isFastDay.js.map +1 -1
- package/dist/esm/locale.js +1 -1
- package/dist/esm/location.js +2 -7
- package/dist/esm/location.js.map +1 -1
- package/dist/esm/modern.d.ts +8 -13
- package/dist/esm/modern.js +141 -17
- package/dist/esm/modern.js.map +1 -1
- package/dist/esm/molad.js +2 -2
- package/dist/esm/molad.js.map +1 -1
- package/dist/esm/moladBase.js +2 -3
- package/dist/esm/moladBase.js.map +1 -1
- package/dist/esm/moladDate.js +1 -1
- package/dist/esm/moladDate.js.map +1 -1
- package/dist/esm/omer.js +22 -28
- package/dist/esm/omer.js.map +1 -1
- package/dist/esm/parshaName.d.ts +1 -1
- package/dist/esm/parshaName.js +3 -4
- package/dist/esm/parshaName.js.map +1 -1
- package/dist/esm/parshaYear.js +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 +17 -16
- package/dist/esm/reformatTimeStr.js.map +1 -1
- package/dist/esm/sedra.d.ts +0 -2
- package/dist/esm/sedra.js +19 -28
- package/dist/esm/sedra.js.map +1 -1
- package/dist/esm/sefira.json.js +1 -1
- package/dist/esm/staticHolidays.d.ts +8 -14
- package/dist/esm/staticHolidays.js +179 -470
- package/dist/esm/staticHolidays.js.map +1 -1
- package/dist/esm/string.js +1 -1
- package/dist/esm/tachanun.js +2 -6
- package/dist/esm/tachanun.js.map +1 -1
- package/dist/esm/zmanim.d.ts +0 -2
- package/dist/esm/zmanim.js +19 -22
- package/dist/esm/zmanim.js.map +1 -1
- package/package.json +6 -6
- package/po/he-x-NoNikud.po +3 -0
- package/po/he.po +3 -0
|
@@ -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.js';\n\n/** constant for milliseconds in a minute (60,000) */\nconst MINUTE_MILLIS
|
|
1
|
+
{"version":3,"file":"moladDate.js","sources":["../../../src/moladDate.ts"],"sourcesContent":["import 'temporal-polyfill/global';\nimport {getTimezoneOffset} from '@hebcal/hdate';\nimport {MoladBase} from './moladBase.js';\n\n/** constant for milliseconds in a minute (60,000) */\nconst MINUTE_MILLIS = 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 = -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 = (molad.chalakim * 10) / 3;\n const millis = Math.trunc(1000 * (moladSeconds - Math.trunc(moladSeconds)));\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 = '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 = 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,GAAG,EAAE,GAAG,IAAI;AAE/B;;;;;;;;;;;;;;;;;;AAkBG;AACH,SAAS,sBAAsB,CAAC,EAAQ,EAAE,SAAiB,EAAE,IAAY,EAAA;IACvE,MAAM,MAAM,GAA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AY,CAAC,KAAK,CAAC;AACjC;;"}
|
package/dist/esm/omer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.13.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';
|
|
@@ -84,7 +84,7 @@ function omerTodayIsEn(omerDay) {
|
|
|
84
84
|
str += ` and ${daysWithinWeeks} ${daysStr}`;
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
return str
|
|
87
|
+
return `${str} of the Omer`;
|
|
88
88
|
}
|
|
89
89
|
// adapted from pip hdate package (GPL)
|
|
90
90
|
// https://github.com/py-libhdate/py-libhdate/blob/master/hdate/date.py
|
|
@@ -103,23 +103,23 @@ const ones = [
|
|
|
103
103
|
];
|
|
104
104
|
const shnei = 'שְׁנֵי';
|
|
105
105
|
const yamim = 'יָמִים';
|
|
106
|
-
const shneiYamim = shnei
|
|
106
|
+
const shneiYamim = `${shnei} ${yamim}`;
|
|
107
107
|
const shavuot = 'שָׁבוּעוֹת';
|
|
108
108
|
const yom = 'יוֹם';
|
|
109
|
-
const yomEchad = yom
|
|
109
|
+
const yomEchad = `${yom} ${ones[1]}`;
|
|
110
110
|
const asar = 'עָשָׂר';
|
|
111
111
|
function omerTodayIsHe(omerDay) {
|
|
112
112
|
const ten = Math.floor(omerDay / 10);
|
|
113
113
|
const one = omerDay % 10;
|
|
114
114
|
let str = 'הַיּוֹם ';
|
|
115
115
|
if (omerDay === 11) {
|
|
116
|
-
str +=
|
|
116
|
+
str += `אַחַד ${asar}`;
|
|
117
117
|
}
|
|
118
118
|
else if (omerDay === 12) {
|
|
119
|
-
str +=
|
|
119
|
+
str += `שְׁנֵים ${asar}`;
|
|
120
120
|
}
|
|
121
121
|
else if (12 < omerDay && omerDay < 20) {
|
|
122
|
-
str += ones[one]
|
|
122
|
+
str += `${ones[one]} ${asar}`;
|
|
123
123
|
}
|
|
124
124
|
else if (omerDay > 9) {
|
|
125
125
|
str += ones[one];
|
|
@@ -133,18 +133,18 @@ function omerTodayIsHe(omerDay) {
|
|
|
133
133
|
str += tens[ten];
|
|
134
134
|
}
|
|
135
135
|
if (omerDay < 11) {
|
|
136
|
-
str += ones[one]
|
|
136
|
+
str += `${ones[one]} ${yamim} `;
|
|
137
137
|
}
|
|
138
138
|
else {
|
|
139
|
-
str +=
|
|
139
|
+
str += ` ${yom} `;
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
else if (omerDay === 1) {
|
|
143
|
-
str += yomEchad
|
|
143
|
+
str += `${yomEchad} `;
|
|
144
144
|
}
|
|
145
145
|
else {
|
|
146
146
|
// omer == 2
|
|
147
|
-
str += shneiYamim
|
|
147
|
+
str += `${shneiYamim} `;
|
|
148
148
|
}
|
|
149
149
|
if (omerDay > 6) {
|
|
150
150
|
str = str.trim(); // remove trailing space before comma
|
|
@@ -152,14 +152,14 @@ function omerTodayIsHe(omerDay) {
|
|
|
152
152
|
const weeks = Math.floor(omerDay / 7);
|
|
153
153
|
const days = omerDay % 7;
|
|
154
154
|
if (weeks > 2) {
|
|
155
|
-
str += ones[weeks]
|
|
155
|
+
str += `${ones[weeks]} ${shavuot} `;
|
|
156
156
|
}
|
|
157
157
|
else if (weeks === 1) {
|
|
158
|
-
str +=
|
|
158
|
+
str += `שָׁבֽוּעַ ${ones[1]} `;
|
|
159
159
|
}
|
|
160
160
|
else {
|
|
161
161
|
// weeks == 2
|
|
162
|
-
str += shnei
|
|
162
|
+
str += `${shnei} ${shavuot} `;
|
|
163
163
|
}
|
|
164
164
|
if (days) {
|
|
165
165
|
if (days === 2 || days === 3) {
|
|
@@ -172,14 +172,14 @@ function omerTodayIsHe(omerDay) {
|
|
|
172
172
|
str += 'וְ';
|
|
173
173
|
}
|
|
174
174
|
if (days > 2) {
|
|
175
|
-
str += ones[days]
|
|
175
|
+
str += `${ones[days]} ${yamim} `;
|
|
176
176
|
}
|
|
177
177
|
else if (days === 1) {
|
|
178
|
-
str += yomEchad
|
|
178
|
+
str += `${yomEchad} `;
|
|
179
179
|
}
|
|
180
180
|
else {
|
|
181
181
|
// days == 2
|
|
182
|
-
str += shneiYamim
|
|
182
|
+
str += `${shneiYamim} `;
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
}
|
|
@@ -221,8 +221,7 @@ class OmerEvent extends Event {
|
|
|
221
221
|
constructor(date, omerDay) {
|
|
222
222
|
super(date, `Omer ${omerDay}`, flags.OMER_COUNT);
|
|
223
223
|
checkDay(omerDay);
|
|
224
|
-
this.weekNumber =
|
|
225
|
-
this.daysWithinWeeks = omerDay % 7 || 7;
|
|
224
|
+
[this.weekNumber, this.daysWithinWeeks] = getWeeks(omerDay);
|
|
226
225
|
this.omer = omerDay;
|
|
227
226
|
}
|
|
228
227
|
/**
|
|
@@ -248,8 +247,7 @@ class OmerEvent extends Event {
|
|
|
248
247
|
}
|
|
249
248
|
const [weekNum, daysWithinWeeks] = getWeeks(this.omer);
|
|
250
249
|
const config = sefirot[lang];
|
|
251
|
-
const pfxWords = config
|
|
252
|
-
const words = config.words;
|
|
250
|
+
const { pfxWords, words } = config;
|
|
253
251
|
const week = pfxWords ? pfxWords[weekNum] : words[weekNum];
|
|
254
252
|
const dayWithinWeek = words[daysWithinWeeks];
|
|
255
253
|
const infix = pfxWords
|
|
@@ -257,7 +255,7 @@ class OmerEvent extends Event {
|
|
|
257
255
|
: weekNum === 2 || weekNum === 6
|
|
258
256
|
? config.infix26
|
|
259
257
|
: config.infix;
|
|
260
|
-
return
|
|
258
|
+
return `${dayWithinWeek} ${infix}${week}`.normalize();
|
|
261
259
|
}
|
|
262
260
|
/**
|
|
263
261
|
* @param [locale] Optional locale name (defaults to empty locale)
|
|
@@ -266,18 +264,14 @@ class OmerEvent extends Event {
|
|
|
266
264
|
const isHebrewLocale = Locale.isHebrewLocale(locale);
|
|
267
265
|
const omer = this.omer;
|
|
268
266
|
const nth = isHebrewLocale ? gematriya(omer) : Locale.ordinal(omer, locale);
|
|
269
|
-
return nth
|
|
267
|
+
return `${nth} ${Locale.gettext('day of the Omer', locale)}`;
|
|
270
268
|
}
|
|
271
269
|
/**
|
|
272
270
|
* Returns translation of "Omer day 22" without ordinal numbers.
|
|
273
271
|
* @param [locale] Optional locale name (defaults to empty locale)
|
|
274
272
|
*/
|
|
275
273
|
renderBrief(locale) {
|
|
276
|
-
return
|
|
277
|
-
' ' +
|
|
278
|
-
Locale.gettext('day', locale) +
|
|
279
|
-
' ' +
|
|
280
|
-
this.omer);
|
|
274
|
+
return `${Locale.gettext('Omer', locale)} ${Locale.gettext('day', locale)} ${this.omer}`;
|
|
281
275
|
}
|
|
282
276
|
/**
|
|
283
277
|
* Returns an emoji number symbol with a circle, for example `㊲`
|
package/dist/esm/omer.js.map
CHANGED
|
@@ -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.js';\nimport './locale.js'; // Adds Hebrew and Ashkenazic translations\nimport sefira from './sefira.json.js';\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,QAAQ;YACR,SAAS;YACT,SAAS;YACT,SAAS;YACT,KAAK;YACL,OAAO;YACP,SAAS;AACV,SAAA;AACD,QAAA,QAAQ,EAAE,IAAI;AACf,KAAA;CACO;AAEV,SAAS,QAAQ,CAAC,OAAe,EAAA;IAC/B,IAAI,OAAO,GAAG,CAAC,IAAI,OAAO,GAAG,EAAE,EAAE;AAC/B,QAAA,MAAM,IAAI,UAAU,CAAC,oBAAoB,OAAO,CAAA,CAAE,CAAC;IACrD;AACF;AAEA,SAAS,QAAQ,CAAC,OAAe,EAAA;AAC/B,IAAA,MA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I,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.js';\nimport './locale.js'; // Adds Hebrew and Ashkenazic translations\nimport sefira from './sefira.json.js';\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, number] {\n const weekNum = Math.floor((omerDay - 1) / 7) + 1;\n const daysWithinWeeks = omerDay % 7 || 7;\n return [weekNum, daysWithinWeeks];\n}\n\nfunction omerTodayIsEn(omerDay: number): string {\n const [weekNumber, daysWithinWeeks] = getWeeks(omerDay);\n\n const totalDaysStr = omerDay === 1 ? 'day' : 'days';\n let str = `Today is ${omerDay} ${totalDaysStr}`;\n\n if (weekNumber > 1 || omerDay === 7) {\n const day7 = daysWithinWeeks === 7;\n const numWeeks = day7 ? weekNumber : weekNumber - 1;\n const weeksStr = numWeeks === 1 ? 'week' : 'weeks';\n str += `, which are ${numWeeks} ${weeksStr}`;\n if (!day7) {\n const daysStr = 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 = Math.floor(omerDay / 10);\n const one = 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 = Math.floor(omerDay / 7);\n const days = 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, this.daysWithinWeeks] = getWeeks(omerDay);\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] = getWeeks(this.omer);\n const config = sefirot[lang];\n const {pfxWords, words} = config;\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 `${Locale.gettext('Omer', locale)} ${Locale.gettext('day', locale)} ${this.omer}`;\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":";;;;;;A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AG,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;;"}
|
package/dist/esm/parshaName.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/** @
|
|
1
|
+
/** @internal */
|
|
2
2
|
export declare function renderParshaName(parsha: string[], locale?: string): string;
|
package/dist/esm/parshaName.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.13.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';
|
|
5
5
|
|
|
6
|
-
/** @
|
|
6
|
+
/** @internal */
|
|
7
7
|
function renderParshaName(parsha, locale) {
|
|
8
8
|
let name = Locale.gettext(parsha[0], locale);
|
|
9
9
|
if (parsha.length === 2) {
|
|
@@ -11,8 +11,7 @@ function renderParshaName(parsha, locale) {
|
|
|
11
11
|
name += hyphen + Locale.gettext(parsha[1], locale);
|
|
12
12
|
}
|
|
13
13
|
name = smartApostrophe(name);
|
|
14
|
-
|
|
15
|
-
return str.normalize();
|
|
14
|
+
return `${Locale.gettext('Parashat', locale)} ${name}`.normalize();
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
export { renderParshaName };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parshaName.js","sources":["../../../src/parshaName.ts"],"sourcesContent":["import {Locale} from './locale.js';\nimport {smartApostrophe} from './string.js';\n\n/** @
|
|
1
|
+
{"version":3,"file":"parshaName.js","sources":["../../../src/parshaName.ts"],"sourcesContent":["import {Locale} from './locale.js';\nimport {smartApostrophe} from './string.js';\n\n/** @internal */\nexport function renderParshaName(parsha: string[], locale?: string): string {\n let name = Locale.gettext(parsha[0], locale);\n if (parsha.length === 2) {\n const hyphen = Locale.isHebrewLocale(locale) ? '־' : '-';\n name += hyphen + Locale.gettext(parsha[1], locale);\n }\n name = smartApostrophe(name);\n return `${Locale.gettext('Parashat', locale)} ${name}`.normalize();\n}\n"],"names":[],"mappings":";;;;;AAGA;AACM,SAAU,gBAAgB,CAAC,MAAgB,EAAE,MAAe,EAAA;AAChE,IAAA,IAAI,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC;AAC5C,IAAA,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;AACvB,QAAA,MAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,GAAG,GAAG,GAAG;AACxD,QAAA,IAAI,IAAI,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC;IACpD;AACA,IAAA,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC;AAC5B,IAAA,OAAO,CAAA,EAAG,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,IAAI,CAAA,CAAE,CAAC,SAAS,EAAE;AACpE;;"}
|
package/dist/esm/parshaYear.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.13.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';
|
package/dist/esm/pkgVersion.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** DO NOT EDIT THIS AUTO-GENERATED FILE! */
|
|
2
|
-
export declare const version = "6.
|
|
2
|
+
export declare const version = "6.13.0";
|
package/dist/esm/pkgVersion.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.13.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.
|
|
3
|
+
const version = '6.13.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.
|
|
1
|
+
{"version":3,"file":"pkgVersion.js","sources":["../../../src/pkgVersion.ts"],"sourcesContent":["/** DO NOT EDIT THIS AUTO-GENERATED FILE! */\nexport const version = '6.13.0';\n"],"names":[],"mappings":";AAAA;AACO,MAAM,OAAO,GAAG;;"}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
/*! @hebcal/core v6.13.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
|
+
/** Countries that conventionally use a 12-hour clock */
|
|
3
|
+
const hour12cc = new Set([
|
|
4
|
+
'US',
|
|
5
|
+
'CA',
|
|
6
|
+
'BR',
|
|
7
|
+
'AU',
|
|
8
|
+
'NZ',
|
|
9
|
+
'DO',
|
|
10
|
+
'PR',
|
|
11
|
+
'GR',
|
|
12
|
+
'IN',
|
|
13
|
+
'KR',
|
|
14
|
+
'NP',
|
|
15
|
+
'ZA',
|
|
16
|
+
]);
|
|
16
17
|
/**
|
|
17
18
|
* Helper function to format a 24-hour (00:00-23:59) time string in either
|
|
18
19
|
* 12-hour US format (e.g. `"8:13pm"`) or keep it in 24-hour format (e.g.
|
|
@@ -39,7 +40,7 @@ function reformatTimeStr(timeStr, suffix, options) {
|
|
|
39
40
|
if (hour12 !== undefined && !hour12) {
|
|
40
41
|
return timeStr;
|
|
41
42
|
}
|
|
42
|
-
if (!hour12 && hour12cc
|
|
43
|
+
if (!hour12 && !hour12cc.has(cc)) {
|
|
43
44
|
return timeStr;
|
|
44
45
|
}
|
|
45
46
|
const hm = timeStr.split(':');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reformatTimeStr.js","sources":["../../../src/reformatTimeStr.ts"],"sourcesContent":["import {CalOptions} from './CalOptions.js';\n\nconst hour12cc:
|
|
1
|
+
{"version":3,"file":"reformatTimeStr.js","sources":["../../../src/reformatTimeStr.ts"],"sourcesContent":["import {CalOptions} from './CalOptions.js';\n\n/** Countries that conventionally use a 12-hour clock */\nconst hour12cc: ReadonlySet<string> = new Set([\n 'US',\n 'CA',\n 'BR',\n 'AU',\n 'NZ',\n 'DO',\n 'PR',\n 'GR',\n 'IN',\n 'KR',\n 'NP',\n 'ZA',\n]);\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.has(cc)) {\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;AACA,MAAM,QAAQ,GAAwB,IAAI,GAAG,CAAC;IAC5C,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;AACL,CAAA,CAAC;AAEF;;;;;;;;;;;;;;;;;AAiBG;SACa,eAAe,CAC7B,OAAe,EACf,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
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.13.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
import { HDate, months } from '@hebcal/hdate';
|
|
3
3
|
import QuickLRU from 'quick-lru';
|
|
4
4
|
import './locale.js';
|
|
@@ -296,13 +296,7 @@ class Sedra {
|
|
|
296
296
|
* @param hd Hebrew date or R.D. days
|
|
297
297
|
*/
|
|
298
298
|
lookup(hd) {
|
|
299
|
-
const abs =
|
|
300
|
-
if (isNaN(abs)) {
|
|
301
|
-
throw new TypeError(`Bad date argument: ${hd}`);
|
|
302
|
-
}
|
|
303
|
-
if (abs < this.rh) {
|
|
304
|
-
throw new RangeError(`Date ${hd} before start of Hebrew year ${this.year}`);
|
|
305
|
-
}
|
|
299
|
+
const abs = toAbsInYear(hd, this.rh, this.year);
|
|
306
300
|
// find the first saturday on or after today's date
|
|
307
301
|
const saturday = HDate.dayOnOrBefore(6, abs + 6);
|
|
308
302
|
const weekNum = (saturday - this.firstSaturday) / 7;
|
|
@@ -357,13 +351,7 @@ class Sedra {
|
|
|
357
351
|
* @param hd Hebrew date or R.D. days
|
|
358
352
|
*/
|
|
359
353
|
lookupWeekday(hd) {
|
|
360
|
-
const abs =
|
|
361
|
-
if (isNaN(abs)) {
|
|
362
|
-
throw new TypeError(`Bad date argument: ${hd}`);
|
|
363
|
-
}
|
|
364
|
-
if (abs < this.rh) {
|
|
365
|
-
throw new RangeError(`Date ${hd} before start of Hebrew year ${this.year}`);
|
|
366
|
-
}
|
|
354
|
+
const abs = toAbsInYear(hd, this.rh, this.year);
|
|
367
355
|
const hdate = new HDate(abs);
|
|
368
356
|
const day = hdate.getDay();
|
|
369
357
|
if (day !== 1 && day !== 4) {
|
|
@@ -412,8 +400,6 @@ class Sedra {
|
|
|
412
400
|
* * parshiot[1] == `Noach`
|
|
413
401
|
* * parshiot[52] == `Ha'azinu`
|
|
414
402
|
* * parshiot[53] == `Vezot Haberakhah`
|
|
415
|
-
* @readonly
|
|
416
|
-
* @type {string[]}
|
|
417
403
|
*/
|
|
418
404
|
const parshiot = [
|
|
419
405
|
'Bereshit',
|
|
@@ -471,13 +457,23 @@ const parshiot = [
|
|
|
471
457
|
"Ha'azinu",
|
|
472
458
|
'Vezot Haberakhah',
|
|
473
459
|
];
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
460
|
+
/**
|
|
461
|
+
* Converts a `Sedra.lookup*()` argument to R.D. days, validating that it is a
|
|
462
|
+
* date on or after Rosh Hashana of `year` (whose R.D. day is `rh`)
|
|
463
|
+
*/
|
|
464
|
+
function toAbsInYear(hd, rh, year) {
|
|
465
|
+
const abs = typeof hd === 'number' ? hd : HDate.isHDate(hd) ? hd.abs() : NaN;
|
|
466
|
+
if (isNaN(abs)) {
|
|
467
|
+
throw new TypeError(`Bad date argument: ${hd}`);
|
|
468
|
+
}
|
|
469
|
+
if (abs < rh) {
|
|
470
|
+
throw new RangeError(`Date ${hd} before start of Hebrew year ${year}`);
|
|
471
|
+
}
|
|
472
|
+
return abs;
|
|
479
473
|
}
|
|
480
474
|
// 0-based parsha IDs
|
|
475
|
+
const parsha2id = new Map(parshiot.map((name, id) => [name, id]));
|
|
476
|
+
// 0-based parsha IDs
|
|
481
477
|
const doubles = new Set([
|
|
482
478
|
21, // Vayakhel-Pekudei
|
|
483
479
|
26, // Tazria-Metzora
|
|
@@ -488,7 +484,6 @@ const doubles = new Set([
|
|
|
488
484
|
50, // Nitzavim-Vayeilech
|
|
489
485
|
]);
|
|
490
486
|
/**
|
|
491
|
-
* @private
|
|
492
487
|
* @param id a negative number
|
|
493
488
|
*/
|
|
494
489
|
function isValidDouble(id) {
|
|
@@ -496,7 +491,6 @@ function isValidDouble(id) {
|
|
|
496
491
|
}
|
|
497
492
|
/**
|
|
498
493
|
* parsha doubler/undoubler
|
|
499
|
-
* @private
|
|
500
494
|
* @param p
|
|
501
495
|
*/
|
|
502
496
|
function D(p) {
|
|
@@ -515,12 +509,11 @@ const PESACH8 = 'Pesach VIII';
|
|
|
515
509
|
const SHAVUOT = 'Shavuot'; // 33
|
|
516
510
|
/**
|
|
517
511
|
* Returns an array from start to end
|
|
518
|
-
* @private
|
|
519
512
|
* @param start beginning number, inclusive
|
|
520
513
|
* @param stop ending number, inclusive
|
|
521
514
|
*/
|
|
522
515
|
function range(start, stop) {
|
|
523
|
-
return Array.from({ length: stop - start + 1 }, (
|
|
516
|
+
return Array.from({ length: stop - start + 1 }, (_, k) => k + start);
|
|
524
517
|
}
|
|
525
518
|
const yearStartVayeilech = [51, 52, CHMSUKOT];
|
|
526
519
|
const yearStartHaazinu = [52, YK, CHMSUKOT];
|
|
@@ -533,8 +526,6 @@ const r4350 = range(43, 50);
|
|
|
533
526
|
/**
|
|
534
527
|
* The ordinary year types (keviot)
|
|
535
528
|
* names are leap/nonleap - day - incomplete/regular/complete - diaspora/Israel
|
|
536
|
-
* @private
|
|
537
|
-
* @readonly
|
|
538
529
|
*/
|
|
539
530
|
const types = {
|
|
540
531
|
/* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
|