@hebcal/core 6.14.3 → 6.14.5
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 +217 -166
- package/dist/bundle.js.map +1 -1
- package/dist/bundle.min.js +6 -6
- package/dist/bundle.min.js.map +1 -1
- package/dist/esm/DailyLearning.js +1 -1
- package/dist/esm/HebrewDateEvent.js +1 -1
- package/dist/esm/HebrewDateEvent.js.map +1 -1
- package/dist/esm/HolidayEvent.d.ts +2 -1
- package/dist/esm/HolidayEvent.js +6 -2
- package/dist/esm/HolidayEvent.js.map +1 -1
- package/dist/esm/KiddushLevanaEvent.js +1 -1
- package/dist/esm/KiddushLevanaEvent.js.map +1 -1
- package/dist/esm/MevarchimChodeshEvent.js +1 -1
- package/dist/esm/MevarchimChodeshEvent.js.map +1 -1
- package/dist/esm/ParshaEvent.js +1 -1
- package/dist/esm/ParshaEvent.js.map +1 -1
- package/dist/esm/TimedEvent.js +1 -1
- package/dist/esm/TimedEvent.js.map +1 -1
- package/dist/esm/YomKippurKatanEvent.js +1 -1
- package/dist/esm/YomKippurKatanEvent.js.map +1 -1
- package/dist/esm/ashkenazi.po.js +1 -1
- package/dist/esm/calendar.d.ts +10 -0
- package/dist/esm/calendar.js +36 -27
- package/dist/esm/calendar.js.map +1 -1
- package/dist/esm/candles.js +1 -1
- package/dist/esm/candles.js.map +1 -1
- package/dist/esm/cities.json.js +1 -1
- package/dist/esm/event.js +1 -1
- package/dist/esm/getStartAndEnd.js +1 -1
- package/dist/esm/hallel.js +1 -1
- package/dist/esm/he-x-NoNikud.po.js +1 -1
- package/dist/esm/he.po.js +1 -1
- package/dist/esm/hebcal.js +1 -1
- package/dist/esm/holidays.d.ts +26 -8
- package/dist/esm/holidays.js +54 -15
- package/dist/esm/holidays.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/isAssurBemlacha.js +1 -1
- package/dist/esm/isAveilut.js +1 -1
- package/dist/esm/isFastDay.js +1 -1
- package/dist/esm/locale.js +1 -1
- package/dist/esm/location.js +1 -1
- package/dist/esm/location.js.map +1 -1
- package/dist/esm/modern.js +1 -1
- package/dist/esm/molad.js +1 -1
- 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.js +1 -1
- package/dist/esm/omer.js.map +1 -1
- package/dist/esm/parshaName.js +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 +1 -1
- package/dist/esm/sedra.js +1 -1
- package/dist/esm/sefira.json.js +1 -1
- package/dist/esm/staticHolidays.js +1 -1
- package/dist/esm/string.js +1 -1
- package/dist/esm/tachanun.js +1 -1
- package/dist/esm/zenith.js +1 -1
- package/dist/esm/zmanim.js +1 -1
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.14.
|
|
1
|
+
/*! @hebcal/core v6.14.5, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
const cals = new Map();
|
|
3
3
|
/**
|
|
4
4
|
* Plug-in registry for daily learning calendars such as Daf Yomi (Bavli),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.14.
|
|
1
|
+
/*! @hebcal/core v6.14.5, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
import { Locale, gematriya, months } from '@hebcal/hdate';
|
|
3
3
|
import { Event, flags } from './event.js';
|
|
4
4
|
import './locale.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HebrewDateEvent.js","sources":["../../../src/HebrewDateEvent.ts"],"sourcesContent":["import {HDate, gematriya, months, Locale} from '@hebcal/hdate';\nimport {Event, flags} from './event.js';\nimport './locale.js'; // Adds Hebrew and Ashkenazic translations\n\n/** Daily Hebrew date (\"11th of Sivan, 5780\") */\nexport class HebrewDateEvent extends Event {\n /**\n * @param date\n */\n constructor(date: HDate) {\n super(date, date.toString(), flags.HEBREW_DATE);\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n * @example\n * import {HDate, HebrewDateEvent, months} from '@hebcal/core';\n *\n * const hd = new HDate(15, months.CHESHVAN, 5769);\n * const ev = new HebrewDateEvent(hd);\n * console.log(ev.render('en')); // '15th of Cheshvan, 5769'\n * console.log(ev.render('he')); // 'ט״ו חֶשְׁוָן תשס״ט'\n */\n render(locale?: string): string {\n const locale1 = locale?.toLowerCase();\n const locale0 = locale1 ?? 'en';\n const hd = this.getDate();\n switch (locale0) {\n case 'h':\n case 'he':\n return hd.renderGematriya(false);\n case 'he-x-nonikud':\n return hd.renderGematriya(true);\n default:\n return hd.render(locale0, true);\n }\n }\n private renderBriefHebrew(locale: string): string {\n const hd = this.getDate();\n const dd = hd.getDate();\n const mm = Locale.gettext(hd.getMonthName(), locale);\n return `${gematriya(dd)} ${mm}`;\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n * @example\n * import {HDate, HebrewDateEvent, months} from '@hebcal/core';\n *\n * const hd = new HDate(15, months.CHESHVAN, 5769);\n * const ev = new HebrewDateEvent(hd);\n * console.log(ev.renderBrief()); // '15th of Cheshvan'\n * console.log(ev.renderBrief('he')); // 'ט״ו חֶשְׁוָן'\n */\n renderBrief(locale?: string): string {\n const locale1 = locale?.toLowerCase();\n const locale0 = locale1 ?? 'en';\n const hd = this.getDate();\n if (hd.getMonth() === months.TISHREI && hd.getDate() === 1) {\n return this.render(locale0);\n }\n switch (locale0) {\n case 'h':\n case 'he':\n case 'he-x-nonikud':\n return this.renderBriefHebrew(locale0);\n default:\n return hd.render(locale0, false);\n }\n }\n}\n"],"names":[],"mappings":";;;;;AAIA;AACM,MAAO,eAAgB,SAAQ,KAAK,CAAA;AACxC;;AAEG;AACH,IAAA,WAAA,CAAY,IAAW,EAAA;AACrB,QAAA,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,WAAW,CAAC;IACjD;AACA;;;;;;;;;AASG;
|
|
1
|
+
{"version":3,"file":"HebrewDateEvent.js","sources":["../../../src/HebrewDateEvent.ts"],"sourcesContent":["import {HDate, gematriya, months, Locale} from '@hebcal/hdate';\nimport {Event, flags} from './event.js';\nimport './locale.js'; // Adds Hebrew and Ashkenazic translations\n\n/** Daily Hebrew date (\"11th of Sivan, 5780\") */\nexport class HebrewDateEvent extends Event {\n /**\n * @param date\n */\n constructor(date: HDate) {\n super(date, date.toString(), flags.HEBREW_DATE);\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n * @example\n * import {HDate, HebrewDateEvent, months} from '@hebcal/core';\n *\n * const hd = new HDate(15, months.CHESHVAN, 5769);\n * const ev = new HebrewDateEvent(hd);\n * console.log(ev.render('en')); // '15th of Cheshvan, 5769'\n * console.log(ev.render('he')); // 'ט״ו חֶשְׁוָן תשס״ט'\n */\n override render(locale?: string): string {\n const locale1 = locale?.toLowerCase();\n const locale0 = locale1 ?? 'en';\n const hd = this.getDate();\n switch (locale0) {\n case 'h':\n case 'he':\n return hd.renderGematriya(false);\n case 'he-x-nonikud':\n return hd.renderGematriya(true);\n default:\n return hd.render(locale0, true);\n }\n }\n private renderBriefHebrew(locale: string): string {\n const hd = this.getDate();\n const dd = hd.getDate();\n const mm = Locale.gettext(hd.getMonthName(), locale);\n return `${gematriya(dd)} ${mm}`;\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n * @example\n * import {HDate, HebrewDateEvent, months} from '@hebcal/core';\n *\n * const hd = new HDate(15, months.CHESHVAN, 5769);\n * const ev = new HebrewDateEvent(hd);\n * console.log(ev.renderBrief()); // '15th of Cheshvan'\n * console.log(ev.renderBrief('he')); // 'ט״ו חֶשְׁוָן'\n */\n override renderBrief(locale?: string): string {\n const locale1 = locale?.toLowerCase();\n const locale0 = locale1 ?? 'en';\n const hd = this.getDate();\n if (hd.getMonth() === months.TISHREI && hd.getDate() === 1) {\n return this.render(locale0);\n }\n switch (locale0) {\n case 'h':\n case 'he':\n case 'he-x-nonikud':\n return this.renderBriefHebrew(locale0);\n default:\n return hd.render(locale0, false);\n }\n }\n}\n"],"names":[],"mappings":";;;;;AAIA;AACM,MAAO,eAAgB,SAAQ,KAAK,CAAA;AACxC;;AAEG;AACH,IAAA,WAAA,CAAY,IAAW,EAAA;AACrB,QAAA,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,WAAW,CAAC;IACjD;AACA;;;;;;;;;AASG;AACM,IAAA,MAAM,CAAC,MAAe,EAAA;AAC7B,QAAA,MAAM,OAAO,GAAG,MAAM,EAAE,WAAW,EAAE;AACrC,QAAA,MAAM,OAAO,GAAG,OAAO,IAAI,IAAI;AAC/B,QAAA,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE;QACzB,QAAQ,OAAO;AACb,YAAA,KAAK,GAAG;AACR,YAAA,KAAK,IAAI;AACP,gBAAA,OAAO,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC;AAClC,YAAA,KAAK,cAAc;AACjB,gBAAA,OAAO,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC;AACjC,YAAA;gBACE,OAAO,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC;;IAErC;AACQ,IAAA,iBAAiB,CAAC,MAAc,EAAA;AACtC,QAAA,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE;AACzB,QAAA,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE;AACvB,QAAA,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,EAAE,MAAM,CAAC;QACpD,OAAO,CAAA,EAAG,SAAS,CAAC,EAAE,CAAC,CAAA,CAAA,EAAI,EAAE,EAAE;IACjC;AACA;;;;;;;;;AASG;AACM,IAAA,WAAW,CAAC,MAAe,EAAA;AAClC,QAAA,MAAM,OAAO,GAAG,MAAM,EAAE,WAAW,EAAE;AACrC,QAAA,MAAM,OAAO,GAAG,OAAO,IAAI,IAAI;AAC/B,QAAA,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE;AACzB,QAAA,IAAI,EAAE,CAAC,QAAQ,EAAE,KAAK,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;AAC1D,YAAA,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;QAC7B;QACA,QAAQ,OAAO;AACb,YAAA,KAAK,GAAG;AACR,YAAA,KAAK,IAAI;AACT,YAAA,KAAK,cAAc;AACjB,gBAAA,OAAO,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC;AACxC,YAAA;gBACE,OAAO,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC;;IAEtC;AACD;;"}
|
|
@@ -44,7 +44,8 @@ export declare class HolidayEvent extends Event {
|
|
|
44
44
|
/**
|
|
45
45
|
* Returns a `https://www.hebcal.com/holidays/...` URL for more detail on
|
|
46
46
|
* this holiday. Israel-only holidays get an `?i=on` query parameter.
|
|
47
|
-
* Returns `undefined` for years outside `[100, 2999]
|
|
47
|
+
* Returns `undefined` for years outside `[100, 2999]` and for
|
|
48
|
+
* Ta'anit BeHaB, which has no holiday page.
|
|
48
49
|
*/
|
|
49
50
|
url(): string | undefined;
|
|
50
51
|
/**
|
package/dist/esm/HolidayEvent.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.14.
|
|
1
|
+
/*! @hebcal/core v6.14.5, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
import { isoDateString, Locale } from '@hebcal/hdate';
|
|
3
3
|
import { Event, flags } from './event.js';
|
|
4
4
|
import { holidayDesc } from './staticHolidays.js';
|
|
@@ -63,9 +63,13 @@ class HolidayEvent extends Event {
|
|
|
63
63
|
/**
|
|
64
64
|
* Returns a `https://www.hebcal.com/holidays/...` URL for more detail on
|
|
65
65
|
* this holiday. Israel-only holidays get an `?i=on` query parameter.
|
|
66
|
-
* Returns `undefined` for years outside `[100, 2999]
|
|
66
|
+
* Returns `undefined` for years outside `[100, 2999]` and for
|
|
67
|
+
* Ta'anit BeHaB, which has no holiday page.
|
|
67
68
|
*/
|
|
68
69
|
url() {
|
|
70
|
+
if (this.hasFlag('BEHAB')) {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
69
73
|
const year = this.greg().getFullYear();
|
|
70
74
|
if (year < 100 || year > 2999) {
|
|
71
75
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HolidayEvent.js","sources":["../../../src/HolidayEvent.ts"],"sourcesContent":["import {HDate, Locale, isoDateString} from '@hebcal/hdate';\nimport {Event, flags} from './event.js';\nimport {holidayDesc as hdesc} from './staticHolidays.js';\nimport {smartApostrophe, urlFriendly} from './string.js';\nimport './locale.js'; // Adds Hebrew and Ashkenazic translations\n\n/**\n * Represents a built-in holiday like Pesach, Purim or Tu BiShvat.\n *\n * Most holiday-related events emitted by {@link calendar}\n * are instances of `HolidayEvent` or one of its subclasses\n * ({@link ChanukahEvent}, {@link AsaraBTevetEvent},\n * {@link RoshHashanaEvent}, {@link RoshChodeshEvent}).\n *\n * Adds two notable behaviors over the base {@link Event}:\n *\n * - {@link HolidayEvent.basename} strips qualifiers like `Erev `, ` I`/`II`,\n * `(CH''M)`, `(observed)`, candle counts, etc. (e.g. `\"Erev Pesach\"` →\n * `\"Pesach\"`).\n * - {@link HolidayEvent.url} returns a `https://www.hebcal.com/holidays/...`\n * link for the holiday.\n */\nexport class HolidayEvent extends Event {\n /** During Sukkot or Pesach */\n readonly cholHaMoedDay?: number;\n /**\n * `true` if the fast day was postponed a day to avoid Shabbat.\n * - Tish'a B'Av postponed from the 9th to the 10th\n * - Tzom Tammuz postponed from the 17th to the 18th\n */\n readonly observed?: boolean;\n constructor(date: HDate, desc: string, mask = 0, attrs?: object) {\n super(date, desc, mask, attrs);\n if (typeof attrs === 'object' && attrs !== null) {\n Object.assign(this, attrs);\n }\n }\n\n /**\n * Returns a simplified (untranslated) name for this holiday, stripping\n * qualifiers so that related events group under one name.\n *\n * Strips trailing 4-digit years, `(CH''M)`, `(observed)`, `(Hoshana Raba)`,\n * Roman-numeral day numbers (` I`, ` II`, ...), Chanukah candle counts,\n * `: 8th Day`, and a leading `\"Erev \"`.\n * @example\n * // 'Erev Pesach' => 'Pesach'\n * // 'Sukkot III (CH''M)' => 'Sukkot'\n * // 'Chanukah: 5 Candles' => 'Chanukah'\n * // 'Rosh Hashana 5784' => 'Rosh Hashana'\n */\n basename(): string {\n return this.getDesc()\n .replace(/ \\d{4}$/, '')\n .replace(/ \\(CH''M\\)$/, '')\n .replace(/ \\(observed\\)$/, '')\n .replace(/ \\(Hoshana Raba\\)$/, '')\n .replace(/ [IV]+$/, '')\n .replace(/: \\d Candles?$/, '')\n .replace(/: 8th Day$/, '')\n .replace(/^Erev /, '');\n }\n\n /**\n * Returns a `https://www.hebcal.com/holidays/...` URL for more detail on\n * this holiday. Israel-only holidays get an `?i=on` query parameter.\n * Returns `undefined` for years outside `[100, 2999]`.\n */\n url(): string | undefined {\n const year = this.greg().getFullYear();\n if (year < 100 || year > 2999) {\n return undefined;\n }\n const url = `https://www.hebcal.com/holidays/${urlFriendly(this.basename())}-${this.urlDateSuffix()}`;\n return this.hasFlag('IL_ONLY') ? `${url}?i=on` : url;\n }\n\n /**\n * The date portion of {@link url}. For most holidays this is just the\n * Gregorian year; subclasses override it when a year alone is ambiguous.\n */\n urlDateSuffix(): string {\n return String(this.greg().getFullYear());\n }\n\n getEmoji(): string {\n if (this.emoji) {\n return this.emoji;\n }\n if (this.hasFlag('SPECIAL_SHABBAT')) {\n return '🕍';\n }\n return '✡️';\n }\n\n getCategories(): string[] {\n if (this.cholHaMoedDay) {\n return ['holiday', 'major', 'cholhamoed'];\n }\n const cats = super.getCategories();\n if (cats[0] !== 'unknown') {\n return cats;\n }\n // Don't depend on flags.MINOR_HOLIDAY always being set. Look for minor holidays.\n const desc = this.getDesc();\n switch (desc) {\n case hdesc.LAG_BAOMER:\n case hdesc.LEIL_SELICHOT:\n case hdesc.PESACH_SHENI:\n case hdesc.EREV_PURIM:\n case hdesc.PURIM_KATAN:\n case hdesc.SHUSHAN_PURIM:\n case hdesc.TU_BAV:\n case hdesc.TU_BISHVAT:\n case hdesc.ROSH_HASHANA_LABEHEMOT:\n return ['holiday', 'minor'];\n }\n\n return ['holiday', 'major'];\n }\n /**\n * Returns (translated) description of this event\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n render(locale?: string): string {\n const str = super.render(locale);\n return smartApostrophe(str);\n }\n /**\n * Returns a brief (translated) description of this event.\n * For most events, this is the same as render(). For some events, it procudes\n * a shorter text (e.g. without a time or added description).\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n renderBrief(locale?: string): string {\n const str = super.renderBrief(locale);\n return smartApostrophe(str);\n }\n}\n\n/**\n * Because Asara B'Tevet often occurs twice in the same Gregorian year,\n * we subclass HolidayEvent to generate the correct URL.\n */\nexport class AsaraBTevetEvent extends HolidayEvent {\n /** Full `YYYYMMDD` date, since the Gregorian year alone is ambiguous here */\n urlDateSuffix(): string {\n const isoDate = isoDateString(this.greg());\n return isoDate.replaceAll('-', '');\n }\n}\n\nconst chanukahEmoji = '🕎';\nconst KEYCAP_DIGITS = [\n '0️⃣',\n '1️⃣',\n '2️⃣',\n '3️⃣',\n '4️⃣',\n '5️⃣',\n '6️⃣',\n '7️⃣',\n '8️⃣',\n '9️⃣',\n] as const;\n\n/**\n * Because Chanukah sometimes starts in December and ends in January,\n * we subclass HolidayEvent to generate the correct URL.\n */\nexport class ChanukahEvent extends HolidayEvent {\n readonly chanukahDay?: number;\n /**\n * @param chanukahDay should be undefined for 1st night of Chanukah\n */\n constructor(date: HDate, desc: string, mask: number, chanukahDay?: number) {\n super(date, desc, mask);\n this.chanukahDay = chanukahDay;\n this.emoji = chanukahEmoji;\n if (chanukahDay !== 8) {\n const candles = chanukahDay ? chanukahDay + 1 : 1;\n this.emoji += KEYCAP_DIGITS[candles];\n }\n }\n urlDateSuffix(): string {\n const dt = this.greg();\n let year = dt.getFullYear();\n if (dt.getMonth() === 0) {\n year--;\n }\n return String(year);\n }\n}\n\n/** Represents Rosh Hashana, the Jewish New Year */\nexport class RoshHashanaEvent extends HolidayEvent {\n private readonly hyear: number;\n /**\n * Normally created by {@link calendar} rather than directly.\n * @param date Hebrew date event occurs\n * @param hyear Hebrew year\n * @param mask optional holiday flags\n */\n constructor(date: HDate, hyear: number, mask: number) {\n super(date, `Rosh Hashana ${hyear}`, mask);\n this.hyear = hyear;\n }\n /**\n * Returns (translated) description of this event\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n render(locale?: string): string {\n return `${Locale.gettext('Rosh Hashana', locale)} ${this.hyear}`;\n }\n\n getEmoji(): string {\n return '🍏🍯';\n }\n}\n\nconst roshChodeshStr = 'Rosh Chodesh';\n\n/** Represents Rosh Chodesh, the beginning of a new month */\nexport class RoshChodeshEvent extends HolidayEvent {\n /**\n * Constructs Rosh Chodesh event\n * @param date Hebrew date event occurs\n * @param monthName Hebrew month name (not translated)\n */\n constructor(date: HDate, monthName: string) {\n super(date, `${roshChodeshStr} ${monthName}`, flags.ROSH_CHODESH);\n }\n /**\n * Returns (translated) description of this event\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n render(locale?: string): string {\n const monthName = this.getDesc().substring(roshChodeshStr.length + 1);\n const monthName0 = Locale.gettext(monthName, locale);\n const monthName1 = smartApostrophe(monthName0);\n return `${Locale.gettext(roshChodeshStr, locale)} ${monthName1}`;\n }\n\n basename(): string {\n return this.getDesc();\n }\n\n getEmoji(): string {\n return this.emoji || '🌒';\n }\n}\n"],"names":["hdesc"],"mappings":";;;;;;;AAMA;;;;;;;;;;;;;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,QAAQ,GAAA;AACN,QAAA,OAAO,IAAI,CAAC,OAAO,EAAE;IACvB;IAEA,QAAQ,GAAA;AACN,QAAA,OAAO,IAAI,CAAC,KAAK,IAAI,IAAI;IAC3B;AACD;;"}
|
|
1
|
+
{"version":3,"file":"HolidayEvent.js","sources":["../../../src/HolidayEvent.ts"],"sourcesContent":["import {HDate, Locale, isoDateString} from '@hebcal/hdate';\nimport {Event, flags} from './event.js';\nimport {holidayDesc as hdesc} from './staticHolidays.js';\nimport {smartApostrophe, urlFriendly} from './string.js';\nimport './locale.js'; // Adds Hebrew and Ashkenazic translations\n\n/**\n * Represents a built-in holiday like Pesach, Purim or Tu BiShvat.\n *\n * Most holiday-related events emitted by {@link calendar}\n * are instances of `HolidayEvent` or one of its subclasses\n * ({@link ChanukahEvent}, {@link AsaraBTevetEvent},\n * {@link RoshHashanaEvent}, {@link RoshChodeshEvent}).\n *\n * Adds two notable behaviors over the base {@link Event}:\n *\n * - {@link HolidayEvent.basename} strips qualifiers like `Erev `, ` I`/`II`,\n * `(CH''M)`, `(observed)`, candle counts, etc. (e.g. `\"Erev Pesach\"` →\n * `\"Pesach\"`).\n * - {@link HolidayEvent.url} returns a `https://www.hebcal.com/holidays/...`\n * link for the holiday.\n */\nexport class HolidayEvent extends Event {\n /** During Sukkot or Pesach */\n readonly cholHaMoedDay?: number;\n /**\n * `true` if the fast day was postponed a day to avoid Shabbat.\n * - Tish'a B'Av postponed from the 9th to the 10th\n * - Tzom Tammuz postponed from the 17th to the 18th\n */\n readonly observed?: boolean;\n constructor(date: HDate, desc: string, mask = 0, attrs?: object) {\n super(date, desc, mask, attrs);\n if (typeof attrs === 'object' && attrs !== null) {\n Object.assign(this, attrs);\n }\n }\n\n /**\n * Returns a simplified (untranslated) name for this holiday, stripping\n * qualifiers so that related events group under one name.\n *\n * Strips trailing 4-digit years, `(CH''M)`, `(observed)`, `(Hoshana Raba)`,\n * Roman-numeral day numbers (` I`, ` II`, ...), Chanukah candle counts,\n * `: 8th Day`, and a leading `\"Erev \"`.\n * @example\n * // 'Erev Pesach' => 'Pesach'\n * // 'Sukkot III (CH''M)' => 'Sukkot'\n * // 'Chanukah: 5 Candles' => 'Chanukah'\n * // 'Rosh Hashana 5784' => 'Rosh Hashana'\n */\n override basename(): string {\n return this.getDesc()\n .replace(/ \\d{4}$/, '')\n .replace(/ \\(CH''M\\)$/, '')\n .replace(/ \\(observed\\)$/, '')\n .replace(/ \\(Hoshana Raba\\)$/, '')\n .replace(/ [IV]+$/, '')\n .replace(/: \\d Candles?$/, '')\n .replace(/: 8th Day$/, '')\n .replace(/^Erev /, '');\n }\n\n /**\n * Returns a `https://www.hebcal.com/holidays/...` URL for more detail on\n * this holiday. Israel-only holidays get an `?i=on` query parameter.\n * Returns `undefined` for years outside `[100, 2999]` and for\n * Ta'anit BeHaB, which has no holiday page.\n */\n override url(): string | undefined {\n if (this.hasFlag('BEHAB')) {\n return undefined;\n }\n const year = this.greg().getFullYear();\n if (year < 100 || year > 2999) {\n return undefined;\n }\n const url = `https://www.hebcal.com/holidays/${urlFriendly(this.basename())}-${this.urlDateSuffix()}`;\n return this.hasFlag('IL_ONLY') ? `${url}?i=on` : url;\n }\n\n /**\n * The date portion of {@link url}. For most holidays this is just the\n * Gregorian year; subclasses override it when a year alone is ambiguous.\n */\n urlDateSuffix(): string {\n return String(this.greg().getFullYear());\n }\n\n override getEmoji(): string {\n if (this.emoji) {\n return this.emoji;\n }\n if (this.hasFlag('SPECIAL_SHABBAT')) {\n return '🕍';\n }\n return '✡️';\n }\n\n override getCategories(): string[] {\n if (this.cholHaMoedDay) {\n return ['holiday', 'major', 'cholhamoed'];\n }\n const cats = super.getCategories();\n if (cats[0] !== 'unknown') {\n return cats;\n }\n // Don't depend on flags.MINOR_HOLIDAY always being set. Look for minor holidays.\n const desc = this.getDesc();\n switch (desc) {\n case hdesc.LAG_BAOMER:\n case hdesc.LEIL_SELICHOT:\n case hdesc.PESACH_SHENI:\n case hdesc.EREV_PURIM:\n case hdesc.PURIM_KATAN:\n case hdesc.SHUSHAN_PURIM:\n case hdesc.TU_BAV:\n case hdesc.TU_BISHVAT:\n case hdesc.ROSH_HASHANA_LABEHEMOT:\n return ['holiday', 'minor'];\n }\n\n return ['holiday', 'major'];\n }\n /**\n * Returns (translated) description of this event\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n override render(locale?: string): string {\n const str = super.render(locale);\n return smartApostrophe(str);\n }\n /**\n * Returns a brief (translated) description of this event.\n * For most events, this is the same as render(). For some events, it procudes\n * a shorter text (e.g. without a time or added description).\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n override renderBrief(locale?: string): string {\n const str = super.renderBrief(locale);\n return smartApostrophe(str);\n }\n}\n\n/**\n * Because Asara B'Tevet often occurs twice in the same Gregorian year,\n * we subclass HolidayEvent to generate the correct URL.\n */\nexport class AsaraBTevetEvent extends HolidayEvent {\n /** Full `YYYYMMDD` date, since the Gregorian year alone is ambiguous here */\n override urlDateSuffix(): string {\n const isoDate = isoDateString(this.greg());\n return isoDate.replaceAll('-', '');\n }\n}\n\nconst chanukahEmoji = '🕎';\nconst KEYCAP_DIGITS = [\n '0️⃣',\n '1️⃣',\n '2️⃣',\n '3️⃣',\n '4️⃣',\n '5️⃣',\n '6️⃣',\n '7️⃣',\n '8️⃣',\n '9️⃣',\n] as const;\n\n/**\n * Because Chanukah sometimes starts in December and ends in January,\n * we subclass HolidayEvent to generate the correct URL.\n */\nexport class ChanukahEvent extends HolidayEvent {\n readonly chanukahDay?: number;\n /**\n * @param chanukahDay should be undefined for 1st night of Chanukah\n */\n constructor(date: HDate, desc: string, mask: number, chanukahDay?: number) {\n super(date, desc, mask);\n this.chanukahDay = chanukahDay;\n this.emoji = chanukahEmoji;\n if (chanukahDay !== 8) {\n const candles = chanukahDay ? chanukahDay + 1 : 1;\n this.emoji += KEYCAP_DIGITS[candles];\n }\n }\n override urlDateSuffix(): string {\n const dt = this.greg();\n let year = dt.getFullYear();\n if (dt.getMonth() === 0) {\n year--;\n }\n return String(year);\n }\n}\n\n/** Represents Rosh Hashana, the Jewish New Year */\nexport class RoshHashanaEvent extends HolidayEvent {\n private readonly hyear: number;\n /**\n * Normally created by {@link calendar} rather than directly.\n * @param date Hebrew date event occurs\n * @param hyear Hebrew year\n * @param mask optional holiday flags\n */\n constructor(date: HDate, hyear: number, mask: number) {\n super(date, `Rosh Hashana ${hyear}`, mask);\n this.hyear = hyear;\n }\n /**\n * Returns (translated) description of this event\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n override render(locale?: string): string {\n return `${Locale.gettext('Rosh Hashana', locale)} ${this.hyear}`;\n }\n\n override getEmoji(): string {\n return '🍏🍯';\n }\n}\n\nconst roshChodeshStr = 'Rosh Chodesh';\n\n/** Represents Rosh Chodesh, the beginning of a new month */\nexport class RoshChodeshEvent extends HolidayEvent {\n /**\n * Constructs Rosh Chodesh event\n * @param date Hebrew date event occurs\n * @param monthName Hebrew month name (not translated)\n */\n constructor(date: HDate, monthName: string) {\n super(date, `${roshChodeshStr} ${monthName}`, flags.ROSH_CHODESH);\n }\n /**\n * Returns (translated) description of this event\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n override render(locale?: string): string {\n const monthName = this.getDesc().substring(roshChodeshStr.length + 1);\n const monthName0 = Locale.gettext(monthName, locale);\n const monthName1 = smartApostrophe(monthName0);\n return `${Locale.gettext(roshChodeshStr, locale)} ${monthName1}`;\n }\n\n override basename(): string {\n return this.getDesc();\n }\n\n override getEmoji(): string {\n return this.emoji || '🌒';\n }\n}\n"],"names":["hdesc"],"mappings":";;;;;;;AAMA;;;;;;;;;;;;;;;AAeG;AACG,MAAO,YAAa,SAAQ,KAAK,CAAA;;AAE5B,IAAA,aAAa;AACtB;;;;AAIG;AACM,IAAA,QAAQ;IACjB,WAAA,CAAY,IAAW,EAAE,IAAY,EAAE,IAAI,GAAG,CAAC,EAAE,KAAc,EAAA;QAC7D,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC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 -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.14.
|
|
1
|
+
/*! @hebcal/core v6.14.5, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
import 'temporal-polyfill/global';
|
|
3
3
|
import { Locale, HDate } from '@hebcal/hdate';
|
|
4
4
|
import { flags } from './event.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KiddushLevanaEvent.js","sources":["../../../src/KiddushLevanaEvent.ts"],"sourcesContent":["import 'temporal-polyfill/global';\nimport {HDate, Locale} from '@hebcal/hdate';\nimport {CalOptions} from './CalOptions.js';\nimport {flags} from './event.js';\nimport {getHolidaysOnDate} from './holidays.js';\nimport {Location} from './location.js';\nimport {Molad} from './molad.js';\nimport {reformatTimeStr} from './reformatTimeStr.js';\nimport {TimedEvent} from './TimedEvent.js';\nimport {Zmanim} from './zmanim.js';\nimport './locale.js'; // Adds Hebrew and Ashkenazic translations\n\nconst LATEST_KIDDUSH_LEVANA = 'Latest Kiddush Levana';\n\n/**\n * The latest time to recite _Kiddush Levana_ (Sanctification of the Moon),\n * calculated as halfway between one _molad_ and the next, according to\n * the [Maharil](https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin)\n * (14 days, 18 hours, 22 minutes and 1.666 seconds after the _molad_).\n *\n * Generated by {@link calendar} when `options.kiddushLevanaMaharil` is\n * `true` and `options.location` is provided:\n * - When the time falls during the day (between _alot hashachar_ 16.1° and\n * _tzeit_ 8.5°), it is moved back to _alot hashachar_ that morning, the\n * end of the last night on which Kiddush Levana can be said.\n * - When the time falls during Shabbat or a Yom Tov, it is moved back to\n * regular candle-lighting time before that Shabbat or Yom Tov.\n * - The time is rounded down to the minute, never up.\n *\n * The {@link memo} lists the unadjusted earliest (3 and 7 days after the\n * _molad_) and latest (Maharil and 15 days after the _molad_) times.\n */\nexport class KiddushLevanaEvent extends TimedEvent {\n /** The molad of the month this event belongs to */\n readonly molad: Molad;\n /**\n * Normally created by {@link calendar} rather than directly.\n * @param date Hebrew date the event occurs\n * @param eventTime latest time for Kiddush Levana, possibly adjusted\n * @param location geographic location used to format the time\n * @param molad the molad of the month\n * @param options optional; `locale` and `hour12` affect the formatted times\n */\n constructor(\n date: HDate,\n eventTime: Date,\n location: Location,\n molad: Molad,\n options?: CalOptions\n ) {\n super(\n date,\n LATEST_KIDDUSH_LEVANA,\n flags.KIDDUSH_LEVANA,\n eventTime,\n location,\n undefined,\n options\n );\n this.molad = molad;\n this.memo = makeMemo(molad, location, options);\n }\n\n getEmoji(): string {\n return '🌔';\n }\n\n getCategories(): string[] {\n return ['zmanim', 'kiddushLevana'];\n }\n}\n\nfunction toDate(zdt: Temporal.ZonedDateTime): Date {\n return new Date(zdt.epochMilliseconds);\n}\n\nfunction toZdt(dt: Date, tzid: string): Temporal.ZonedDateTime | null {\n const millis = dt.getTime();\n if (isNaN(millis)) {\n return null;\n }\n return Temporal.Instant.fromEpochMilliseconds(millis).toZonedDateTimeISO(tzid);\n}\n\nfunction floorMinute(zdt: Temporal.ZonedDateTime): Temporal.ZonedDateTime {\n return zdt.round({smallestUnit: 'minute', roundingMode: 'floor'});\n}\n\nfunction ceilMinute(zdt: Temporal.ZonedDateTime): Temporal.ZonedDateTime {\n return zdt.round({smallestUnit: 'minute', roundingMode: 'ceil'});\n}\n\nfunction makeMemo(molad: Molad, location: Location, options?: CalOptions): string {\n const tzid = location.getTzid();\n const locale = options?.locale;\n const times: [string, Temporal.ZonedDateTime][] = [\n [\n 'Earliest Kiddush Levana (3 days)',\n ceilMinute(molad.getTchilasZmanKidushLevana3Days()),\n ],\n [\n 'Earliest Kiddush Levana (7 days)',\n ceilMinute(molad.getTchilasZmanKidushLevana7Days()),\n ],\n [\n 'Latest Kiddush Levana (Maharil)',\n floorMinute(molad.getSofZmanKidushLevanaBetweenMoldos()),\n ],\n [\n 'Latest Kiddush Levana (15 days)',\n floorMinute(molad.getSofZmanKidushLevana15Days()),\n ],\n ];\n const dateFormat = new Intl.DateTimeFormat(intlLocale(locale), {\n timeZone: tzid,\n weekday: 'short',\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n });\n const timeFormat = location.getTimeFormatter();\n const opts = {...options, location};\n return times\n .map(([label, zdt]) => {\n const dt = toDate(zdt);\n const timeStr = reformatTimeStr(\n Zmanim.formatTime(dt, timeFormat),\n 'pm',\n opts\n );\n return `${Locale.gettext(label, locale)}: ${dateFormat.format(dt)}, ${timeStr}`;\n })\n .join('\\n');\n}\n\nfunction intlLocale(locale?: string): string {\n if (!locale || locale === 'en' || locale === 'ashkenazi') {\n return 'en-US';\n }\n if (Locale.isHebrewLocale(locale)) {\n return 'he-IL';\n }\n try {\n return Intl.DateTimeFormat.supportedLocalesOf(locale)[0] ?? 'en-US';\n } catch {\n return 'en-US';\n }\n}\n\nfunction isShabbatOrChag(hd: HDate, il: boolean): boolean {\n if (hd.getDay() === 6) {\n return true;\n }\n const events = getHolidaysOnDate(hd, il) ?? [];\n return events.some(ev => ev.hasFlag('CHAG'));\n}\n\n/**\n * Makes the \"Latest Kiddush Levana\" event for one Hebrew month, or\n * `undefined` if it can't be calculated (e.g. no sunrise or sunset).\n * The returned event's date may be earlier than the date of the\n * actual latest time, when that time falls on Shabbat or a Yom Tov.\n * @internal\n */\nexport function makeKiddushLevanaEvent(\n hyear: number,\n hmonth: number,\n options: CalOptions\n): KiddushLevanaEvent | undefined {\n const location = options.location as Location;\n const useElevation = Boolean(options.useElevation);\n const il = Boolean(options.il);\n const tzid = location.getTzid();\n // Find the civil date on which the Maharil's time falls.\n // Zmanim only computes this zman between the 11th and 16th of the month.\n for (let dd = 11; dd <= 16; dd++) {\n const hd = new HDate(dd, hmonth, hyear);\n const zmanim = new Zmanim(location, hd, useElevation);\n if (zmanim.getSofZmanKidushLevanaBetweenMoldos() === null) {\n continue;\n }\n // Move a daytime time back to alot hashachar that morning\n // Same tzeit (8.5°) as isAssurBemlacha()\n const alos = toZdt(zmanim.alotHaShachar(), tzid);\n const tzeit = toZdt(zmanim.tzeit(), tzid);\n const zdt = zmanim.getSofZmanKidushLevanaBetweenMoldos(alos, tzeit);\n if (zdt === null) {\n return undefined;\n }\n const molad = new Molad(hyear, hmonth);\n // After daytime adjustment the time is at night: before alot hashachar\n // it belongs to today's Hebrew date, after tzeit to tomorrow's.\n const nightOf = zdt.hour < 12 ? hd : hd.next();\n if (!isShabbatOrChag(nightOf, il)) {\n return new KiddushLevanaEvent(\n hd,\n toDate(floorMinute(zdt)),\n location,\n molad,\n options\n );\n }\n // Back up to candle-lighting time before the Shabbat or Yom Tov\n let first = nightOf;\n while (isShabbatOrChag(first.prev(), il)) {\n first = first.prev();\n }\n const erev = first.prev();\n const erevZmanim = new Zmanim(location, erev, useElevation);\n const candleLighting = erevZmanim.sunsetOffset(\n Number(options.candleLightingMins),\n true\n );\n if (isNaN(candleLighting.getTime())) {\n return undefined;\n }\n return new KiddushLevanaEvent(erev, candleLighting, location, molad, options);\n }\n return undefined;\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAYA,MAAM,qBAAqB,GAAG,uBAAuB;AAErD;;;;;;;;;;;;;;;;;AAiBG;AACG,MAAO,kBAAmB,SAAQ,UAAU,CAAA;;AAEvC,IAAA,KAAK;AACd;;;;;;;AAOG;IACH,WAAA,CACE,IAAW,EACX,SAAe,EACf,QAAkB,EAClB,KAAY,EACZ,OAAoB,EAAA;AAEpB,QAAA,KAAK,CACH,IAAI,EACJ,qBAAqB,EACrB,KAAK,CAAC,cAAc,EACpB,SAAS,EACT,QAAQ,EACR,SAAS,EACT,OAAO,CACR;AACD,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK;QAClB,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC;IAChD;IAEA,QAAQ,GAAA;AACN,QAAA,OAAO,IAAI;IACb;IAEA,aAAa,GAAA;AACX,QAAA,OAAO,CAAC,QAAQ,EAAE,eAAe,CAAC;IACpC;AACD;AAED,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,EAAE;AAChB,YAAA,OAAO,SAAS;QAClB;QACA,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC;;;AAGtC,QAAA,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE;QAC9C,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE;AACjC,YAAA,OAAO,IAAI,kBAAkB,CAC3B,EAAE,EACF,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EACxB,QAAQ,EACR,KAAK,EACL,OAAO,CACR;QACH;;QAEA,IAAI,KAAK,GAAG,OAAO;QACnB,OAAO,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE;AACxC,YAAA,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE;QACtB;AACA,QAAA,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,EAAE;QACzB,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,YAAY,CAAC;AAC3D,QAAA,MAAM,cAAc,GAAG,UAAU,CAAC,YAAY,CAC5C,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAClC,IAAI,CACL;QACD,IAAI,KAAK,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,EAAE;AACnC,YAAA,OAAO,SAAS;QAClB;AACA,QAAA,OAAO,IAAI,kBAAkB,CAAC,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC;IAC/E;AACA,IAAA,OAAO,SAAS;AAClB;;"}
|
|
1
|
+
{"version":3,"file":"KiddushLevanaEvent.js","sources":["../../../src/KiddushLevanaEvent.ts"],"sourcesContent":["import 'temporal-polyfill/global';\nimport {HDate, Locale} from '@hebcal/hdate';\nimport {CalOptions} from './CalOptions.js';\nimport {flags} from './event.js';\nimport {getHolidaysOnDate} from './holidays.js';\nimport {Location} from './location.js';\nimport {Molad} from './molad.js';\nimport {reformatTimeStr} from './reformatTimeStr.js';\nimport {TimedEvent} from './TimedEvent.js';\nimport {Zmanim} from './zmanim.js';\nimport './locale.js'; // Adds Hebrew and Ashkenazic translations\n\nconst LATEST_KIDDUSH_LEVANA = 'Latest Kiddush Levana';\n\n/**\n * The latest time to recite _Kiddush Levana_ (Sanctification of the Moon),\n * calculated as halfway between one _molad_ and the next, according to\n * the [Maharil](https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin)\n * (14 days, 18 hours, 22 minutes and 1.666 seconds after the _molad_).\n *\n * Generated by {@link calendar} when `options.kiddushLevanaMaharil` is\n * `true` and `options.location` is provided:\n * - When the time falls during the day (between _alot hashachar_ 16.1° and\n * _tzeit_ 8.5°), it is moved back to _alot hashachar_ that morning, the\n * end of the last night on which Kiddush Levana can be said.\n * - When the time falls during Shabbat or a Yom Tov, it is moved back to\n * regular candle-lighting time before that Shabbat or Yom Tov.\n * - The time is rounded down to the minute, never up.\n *\n * The {@link memo} lists the unadjusted earliest (3 and 7 days after the\n * _molad_) and latest (Maharil and 15 days after the _molad_) times.\n */\nexport class KiddushLevanaEvent extends TimedEvent {\n /** The molad of the month this event belongs to */\n readonly molad: Molad;\n /**\n * Normally created by {@link calendar} rather than directly.\n * @param date Hebrew date the event occurs\n * @param eventTime latest time for Kiddush Levana, possibly adjusted\n * @param location geographic location used to format the time\n * @param molad the molad of the month\n * @param options optional; `locale` and `hour12` affect the formatted times\n */\n constructor(\n date: HDate,\n eventTime: Date,\n location: Location,\n molad: Molad,\n options?: CalOptions\n ) {\n super(\n date,\n LATEST_KIDDUSH_LEVANA,\n flags.KIDDUSH_LEVANA,\n eventTime,\n location,\n undefined,\n options\n );\n this.molad = molad;\n this.memo = makeMemo(molad, location, options);\n }\n\n override getEmoji(): string {\n return '🌔';\n }\n\n override getCategories(): string[] {\n return ['zmanim', 'kiddushLevana'];\n }\n}\n\nfunction toDate(zdt: Temporal.ZonedDateTime): Date {\n return new Date(zdt.epochMilliseconds);\n}\n\nfunction toZdt(dt: Date, tzid: string): Temporal.ZonedDateTime | null {\n const millis = dt.getTime();\n if (isNaN(millis)) {\n return null;\n }\n return Temporal.Instant.fromEpochMilliseconds(millis).toZonedDateTimeISO(tzid);\n}\n\nfunction floorMinute(zdt: Temporal.ZonedDateTime): Temporal.ZonedDateTime {\n return zdt.round({smallestUnit: 'minute', roundingMode: 'floor'});\n}\n\nfunction ceilMinute(zdt: Temporal.ZonedDateTime): Temporal.ZonedDateTime {\n return zdt.round({smallestUnit: 'minute', roundingMode: 'ceil'});\n}\n\nfunction makeMemo(molad: Molad, location: Location, options?: CalOptions): string {\n const tzid = location.getTzid();\n const locale = options?.locale;\n const times: [string, Temporal.ZonedDateTime][] = [\n [\n 'Earliest Kiddush Levana (3 days)',\n ceilMinute(molad.getTchilasZmanKidushLevana3Days()),\n ],\n [\n 'Earliest Kiddush Levana (7 days)',\n ceilMinute(molad.getTchilasZmanKidushLevana7Days()),\n ],\n [\n 'Latest Kiddush Levana (Maharil)',\n floorMinute(molad.getSofZmanKidushLevanaBetweenMoldos()),\n ],\n [\n 'Latest Kiddush Levana (15 days)',\n floorMinute(molad.getSofZmanKidushLevana15Days()),\n ],\n ];\n const dateFormat = new Intl.DateTimeFormat(intlLocale(locale), {\n timeZone: tzid,\n weekday: 'short',\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n });\n const timeFormat = location.getTimeFormatter();\n const opts = {...options, location};\n return times\n .map(([label, zdt]) => {\n const dt = toDate(zdt);\n const timeStr = reformatTimeStr(\n Zmanim.formatTime(dt, timeFormat),\n 'pm',\n opts\n );\n return `${Locale.gettext(label, locale)}: ${dateFormat.format(dt)}, ${timeStr}`;\n })\n .join('\\n');\n}\n\nfunction intlLocale(locale?: string): string {\n if (!locale || locale === 'en' || locale === 'ashkenazi') {\n return 'en-US';\n }\n if (Locale.isHebrewLocale(locale)) {\n return 'he-IL';\n }\n try {\n return Intl.DateTimeFormat.supportedLocalesOf(locale)[0] ?? 'en-US';\n } catch {\n return 'en-US';\n }\n}\n\nfunction isShabbatOrChag(hd: HDate, il: boolean): boolean {\n if (hd.getDay() === 6) {\n return true;\n }\n const events = getHolidaysOnDate(hd, il) ?? [];\n return events.some(ev => ev.hasFlag('CHAG'));\n}\n\n/**\n * Makes the \"Latest Kiddush Levana\" event for one Hebrew month, or\n * `undefined` if it can't be calculated (e.g. no sunrise or sunset).\n * The returned event's date may be earlier than the date of the\n * actual latest time, when that time falls on Shabbat or a Yom Tov.\n * @internal\n */\nexport function makeKiddushLevanaEvent(\n hyear: number,\n hmonth: number,\n options: CalOptions\n): KiddushLevanaEvent | undefined {\n const location = options.location as Location;\n const useElevation = Boolean(options.useElevation);\n const il = Boolean(options.il);\n const tzid = location.getTzid();\n // Find the civil date on which the Maharil's time falls.\n // Zmanim only computes this zman between the 11th and 16th of the month.\n for (let dd = 11; dd <= 16; dd++) {\n const hd = new HDate(dd, hmonth, hyear);\n const zmanim = new Zmanim(location, hd, useElevation);\n if (zmanim.getSofZmanKidushLevanaBetweenMoldos() === null) {\n continue;\n }\n // Move a daytime time back to alot hashachar that morning\n // Same tzeit (8.5°) as isAssurBemlacha()\n const alos = toZdt(zmanim.alotHaShachar(), tzid);\n const tzeit = toZdt(zmanim.tzeit(), tzid);\n const zdt = zmanim.getSofZmanKidushLevanaBetweenMoldos(alos, tzeit);\n if (zdt === null) {\n return undefined;\n }\n const molad = new Molad(hyear, hmonth);\n // After daytime adjustment the time is at night: before alot hashachar\n // it belongs to today's Hebrew date, after tzeit to tomorrow's.\n const nightOf = zdt.hour < 12 ? hd : hd.next();\n if (!isShabbatOrChag(nightOf, il)) {\n return new KiddushLevanaEvent(\n hd,\n toDate(floorMinute(zdt)),\n location,\n molad,\n options\n );\n }\n // Back up to candle-lighting time before the Shabbat or Yom Tov\n let first = nightOf;\n while (isShabbatOrChag(first.prev(), il)) {\n first = first.prev();\n }\n const erev = first.prev();\n const erevZmanim = new Zmanim(location, erev, useElevation);\n const candleLighting = erevZmanim.sunsetOffset(\n Number(options.candleLightingMins),\n true\n );\n if (isNaN(candleLighting.getTime())) {\n return undefined;\n }\n return new KiddushLevanaEvent(erev, candleLighting, location, molad, options);\n }\n return undefined;\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAYA,MAAM,qBAAqB,GAAG,uBAAuB;AAErD;;;;;;;;;;;;;;;;;AAiBG;AACG,MAAO,kBAAmB,SAAQ,UAAU,CAAA;;AAEvC,IAAA,KAAK;AACd;;;;;;;AAOG;IACH,WAAA,CACE,IAAW,EACX,SAAe,EACf,QAAkB,EAClB,KAAY,EACZ,OAAoB,EAAA;AAEpB,QAAA,KAAK,CACH,IAAI,EACJ,qBAAqB,EACrB,KAAK,CAAC,cAAc,EACpB,SAAS,EACT,QAAQ,EACR,SAAS,EACT,OAAO,CACR;AACD,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK;QAClB,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC;IAChD;IAES,QAAQ,GAAA;AACf,QAAA,OAAO,IAAI;IACb;IAES,aAAa,GAAA;AACpB,QAAA,OAAO,CAAC,QAAQ,EAAE,eAAe,CAAC;IACpC;AACD;AAED,SAAS,MAAM,CAAC,GAA2B,EAAA;AACzC,IAAA,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC;AACxC;AAEA,SAAS,KAAK,CAAC,EAAQ,EAAE,IAAY,EAAA;AACnC,IAAA,MAAM,MAAM,GAAG,EAAE,CAAC,OAAO,EAAE;AAC3B,IAAA,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE;AACjB,QAAA,OAAO,IAAI;IACb;AACA,IAAA,OAAO,QAAQ,CAAC,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC;AAChF;AAEA,SAAS,WAAW,CAAC,GAA2B,EAAA;AAC9C,IAAA,O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nB,OAAO,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE;AACxC,YAAA,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE;QACtB;AACA,QAAA,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,EAAE;QACzB,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,YAAY,CAAC;AAC3D,QAAA,MAAM,cAAc,GAAG,UAAU,CAAC,YAAY,CAC5C,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAClC,IAAI,CACL;QACD,IAAI,KAAK,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,EAAE;AACnC,YAAA,OAAO,SAAS;QAClB;AACA,QAAA,OAAO,IAAI,kBAAkB,CAAC,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC;IAC/E;AACA,IAAA,OAAO,SAAS;AAClB;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.14.
|
|
1
|
+
/*! @hebcal/core v6.14.5, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
import { Locale, HDate, months } from '@hebcal/hdate';
|
|
3
3
|
import { Event, flags } from './event.js';
|
|
4
4
|
import { Molad } from './molad.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MevarchimChodeshEvent.js","sources":["../../../src/MevarchimChodeshEvent.ts"],"sourcesContent":["import {HDate, Locale, months} from '@hebcal/hdate';\nimport {Event, flags} from './event.js';\nimport {Molad} from './molad.js';\nimport {smartApostrophe} from './string.js';\nimport './locale.js'; // Adds Hebrew and Ashkenazic translations\n\nconst mevarchimChodeshStr = 'Shabbat Mevarchim Chodesh';\n\n/** Represents Mevarchim haChodesh, the announcement of the new month */\nexport class MevarchimChodeshEvent extends Event {\n readonly monthName: string;\n /**\n * Constructs Mevarchim haChodesh event\n * @param date Hebrew date event occurs\n * @param monthName Hebrew month name (not translated)\n * @param memo text for the event memo. When falsy, a memo announcing the\n * molad of the upcoming month is generated automatically\n * @param locale Optional locale name\n */\n constructor(date: HDate, monthName: string, memo: string, locale?: string) {\n super(date, `${mevarchimChodeshStr} ${monthName}`, flags.SHABBAT_MEVARCHIM);\n this.monthName = Locale.gettext(monthName, locale);\n if (memo) {\n this.memo = memo;\n } else {\n const hyear = date.getFullYear();\n const hmonth = date.getMonth();\n const monNext =\n hmonth === HDate.monthsInYear(hyear) ? months.NISAN : hmonth + 1;\n const molad = new Molad(hyear, monNext);\n this.memo = molad.render('en', {hour12: false});\n }\n }\n\n basename(): string {\n return this.getDesc();\n }\n /**\n * Returns (translated) description of this event\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n render(locale?: string): string {\n const monthName0 = Locale.gettext(this.monthName, locale);\n const monthName = smartApostrophe(monthName0);\n return `${Locale.gettext(mevarchimChodeshStr, locale)} ${monthName}`;\n }\n /**\n * Returns (translated) description of this event\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n renderBrief(locale?: string): string {\n const str = this.render(locale);\n const space = str.indexOf(' ');\n return str.substring(space + 1);\n }\n}\n"],"names":[],"mappings":";;;;;;;AAMA,MAAM,mBAAmB,GAAG,2BAA2B;AAEvD;AACM,MAAO,qBAAsB,SAAQ,KAAK,CAAA;AACrC,IAAA,SAAS;AAClB;;;;;;;AAOG;AACH,IAAA,WAAA,CAAY,IAAW,EAAE,SAAiB,EAAE,IAAY,EAAE,MAAe,EAAA;AACvE,QAAA,KAAK,CAAC,IAAI,EAAE,CAAA,EAAG,mBAAmB,CAAA,CAAA,EAAI,SAAS,CAAA,CAAE,EAAE,KAAK,CAAC,iBAAiB,CAAC;QAC3E,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;QAClD,IAAI,IAAI,EAAE;AACR,YAAA,IAAI,CAAC,IAAI,GAAG,IAAI;QAClB;aAAO;AACL,YAAA,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE;AAChC,YAAA,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE;YAC9B,MAAM,OAAO,GACX,MAAM,KAAK,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,GAAG,MAAM,GAAG,CAAC;YAClE,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC;AACvC,YAAA,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,EAAC,MAAM,EAAE,KAAK,EAAC,CAAC;QACjD;IACF;
|
|
1
|
+
{"version":3,"file":"MevarchimChodeshEvent.js","sources":["../../../src/MevarchimChodeshEvent.ts"],"sourcesContent":["import {HDate, Locale, months} from '@hebcal/hdate';\nimport {Event, flags} from './event.js';\nimport {Molad} from './molad.js';\nimport {smartApostrophe} from './string.js';\nimport './locale.js'; // Adds Hebrew and Ashkenazic translations\n\nconst mevarchimChodeshStr = 'Shabbat Mevarchim Chodesh';\n\n/** Represents Mevarchim haChodesh, the announcement of the new month */\nexport class MevarchimChodeshEvent extends Event {\n readonly monthName: string;\n /**\n * Constructs Mevarchim haChodesh event\n * @param date Hebrew date event occurs\n * @param monthName Hebrew month name (not translated)\n * @param memo text for the event memo. When falsy, a memo announcing the\n * molad of the upcoming month is generated automatically\n * @param locale Optional locale name\n */\n constructor(date: HDate, monthName: string, memo: string, locale?: string) {\n super(date, `${mevarchimChodeshStr} ${monthName}`, flags.SHABBAT_MEVARCHIM);\n this.monthName = Locale.gettext(monthName, locale);\n if (memo) {\n this.memo = memo;\n } else {\n const hyear = date.getFullYear();\n const hmonth = date.getMonth();\n const monNext =\n hmonth === HDate.monthsInYear(hyear) ? months.NISAN : hmonth + 1;\n const molad = new Molad(hyear, monNext);\n this.memo = molad.render('en', {hour12: false});\n }\n }\n\n override basename(): string {\n return this.getDesc();\n }\n /**\n * Returns (translated) description of this event\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n override render(locale?: string): string {\n const monthName0 = Locale.gettext(this.monthName, locale);\n const monthName = smartApostrophe(monthName0);\n return `${Locale.gettext(mevarchimChodeshStr, locale)} ${monthName}`;\n }\n /**\n * Returns (translated) description of this event\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n override renderBrief(locale?: string): string {\n const str = this.render(locale);\n const space = str.indexOf(' ');\n return str.substring(space + 1);\n }\n}\n"],"names":[],"mappings":";;;;;;;AAMA,MAAM,mBAAmB,GAAG,2BAA2B;AAEvD;AACM,MAAO,qBAAsB,SAAQ,KAAK,CAAA;AACrC,IAAA,SAAS;AAClB;;;;;;;AAOG;AACH,IAAA,WAAA,CAAY,IAAW,EAAE,SAAiB,EAAE,IAAY,EAAE,MAAe,EAAA;AACvE,QAAA,KAAK,CAAC,IAAI,EAAE,CAAA,EAAG,mBAAmB,CAAA,CAAA,EAAI,SAAS,CAAA,CAAE,EAAE,KAAK,CAAC,iBAAiB,CAAC;QAC3E,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;QAClD,IAAI,IAAI,EAAE;AACR,YAAA,IAAI,CAAC,IAAI,GAAG,IAAI;QAClB;aAAO;AACL,YAAA,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE;AAChC,YAAA,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE;YAC9B,MAAM,OAAO,GACX,MAAM,KAAK,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,GAAG,MAAM,GAAG,CAAC;YAClE,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC;AACvC,YAAA,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,EAAC,MAAM,EAAE,KAAK,EAAC,CAAC;QACjD;IACF;IAES,QAAQ,GAAA;AACf,QAAA,OAAO,IAAI,CAAC,OAAO,EAAE;IACvB;AACA;;;AAGG;AACM,IAAA,MAAM,CAAC,MAAe,EAAA;AAC7B,QAAA,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC;AACzD,QAAA,MAAM,SAAS,GAAG,eAAe,CAAC,UAAU,CAAC;AAC7C,QAAA,OAAO,CAAA,EAAG,MAAM,CAAC,OAAO,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAA,CAAA,EAAI,SAAS,CAAA,CAAE;IACtE;AACA;;;AAGG;AACM,IAAA,WAAW,CAAC,MAAe,EAAA;QAClC,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QAC/B,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC;QAC9B,OAAO,GAAG,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC;IACjC;AACD;;"}
|
package/dist/esm/ParshaEvent.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.14.
|
|
1
|
+
/*! @hebcal/core v6.14.5, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
import { Event, flags } from './event.js';
|
|
3
3
|
import { HDate, isoDateString } from '@hebcal/hdate';
|
|
4
4
|
import { renderParshaName } from './parshaName.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParshaEvent.js","sources":["../../../src/ParshaEvent.ts"],"sourcesContent":["import {Event, flags} from './event.js';\nimport {HDate, isoDateString} from '@hebcal/hdate';\nimport {renderParshaName} from './parshaName.js';\nimport {urlFriendly} from './string.js';\nimport {SedraResult} from './sedra.js';\nimport './locale.js'; // Adds Hebrew and Ashkenazic translations\n\n/**\n * Represents one of 54 weekly Torah portions, always on a Saturday.\n *\n * `ParshaEvent` is for regular Parashat HaShavua readings. For Shabbatot\n * with holiday readings such as Shabbat Chol ha-Moed, use\n * `getHolidaysOnDate()` from `@hebcal/core`, or `getLeyningOnDate()` from\n * `@hebcal/leyning` when the display title and exact Torah readings are needed.\n */\nexport class ParshaEvent extends Event {\n /** The parsha name(s) and date this event was constructed from */\n readonly p: SedraResult;\n /**\n * Normally created by {@link calendar} (via `options.sedrot`)\n * rather than directly.\n * @param parsha result from {@link Sedra.lookup}\n * @throws {TypeError} if called with anything other than exactly one argument\n * @throws {TypeError} if `parsha` is not a valid {@link SedraResult} — it must\n * have an `HDate` and one or two parsha names\n */\n constructor(parsha: SedraResult) {\n // eslint-disable-next-line prefer-rest-params\n if (arguments.length !== 1) {\n throw new TypeError(\n `ParshaEvent constructor takes a single SedraResult argument; ` +\n `got ${arguments.length} arguments`\n );\n }\n if (\n typeof parsha !== 'object' ||\n parsha === null ||\n !Array.isArray(parsha.parsha) ||\n parsha.parsha.length === 0 ||\n parsha.parsha.length > 2 ||\n !HDate.isHDate(parsha.hdate)\n ) {\n throw new TypeError(\n `Invalid SedraResult argument: ${JSON.stringify(parsha)}`\n );\n }\n const desc = `Parashat ${parsha.parsha.join('-')}`;\n super(parsha.hdate, desc, flags.PARSHA_HASHAVUA);\n this.p = parsha;\n }\n /**\n * @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to empty locale.\n */\n render(locale?: string): string {\n return renderParshaName(this.p.parsha, locale);\n }\n\n basename(): string {\n return this.p.parsha.join('-');\n }\n\n url(): string | undefined {\n const year = this.greg().getFullYear();\n if (year < 100 || year > 2999) {\n return undefined;\n }\n const dt = this.urlDateSuffix();\n const url = `https://www.hebcal.com/sedrot/${urlFriendly(this.basename())}-${dt}`;\n return this.p.il ? `${url}?i=on` : url;\n }\n\n /**\n * The date portion of {@link url}, as `YYYYMMDD` — a parsha name recurs every\n * year, so the full date is needed to identify the reading.\n */\n urlDateSuffix(): string {\n const isoDate = isoDateString(this.greg());\n return isoDate.replaceAll('-', '');\n }\n\n /** convenience function for compatibility with previous implementation */\n get parsha(): string[] {\n return this.p.parsha;\n }\n}\n"],"names":[],"mappings":";;;;;;;AAOA;;;;;;;AAOG;AACG,MAAO,WAAY,SAAQ,KAAK,CAAA;;AAE3B,IAAA,CAAC;AACV;;;;;;;AAOG;AACH,IAAA,WAAA,CAAY,MAAmB,EAAA;;AAE7B,QAAA,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;YAC1B,MAAM,IAAI,SAAS,CACjB,CAAA,6DAAA,CAA+D;AAC7D,gBAAA,CAAA,IAAA,EAAO,SAAS,CAAC,MAAM,CAAA,UAAA,CAAY,CACtC;QACH;QACA,IACE,OAAO,MAAM,KAAK,QAAQ;AAC1B,YAAA,MAAM,KAAK,IAAI;AACf,YAAA,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;AAC7B,YAAA,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC;AAC1B,YAAA,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;YACxB,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAC5B;AACA,YAAA,MAAM,IAAI,SAAS,CACjB,CAAA,8BAAA,EAAiC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA,CAAE,CAC1D;QACH;AACA,QAAA,MAAM,IAAI,GAAG,CAAA,SAAA,EAAY,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA,CAAE;QAClD,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,eAAe,CAAC;AAChD,QAAA,IAAI,CAAC,CAAC,GAAG,MAAM;IACjB;AACA;;AAEG;
|
|
1
|
+
{"version":3,"file":"ParshaEvent.js","sources":["../../../src/ParshaEvent.ts"],"sourcesContent":["import {Event, flags} from './event.js';\nimport {HDate, isoDateString} from '@hebcal/hdate';\nimport {renderParshaName} from './parshaName.js';\nimport {urlFriendly} from './string.js';\nimport {SedraResult} from './sedra.js';\nimport './locale.js'; // Adds Hebrew and Ashkenazic translations\n\n/**\n * Represents one of 54 weekly Torah portions, always on a Saturday.\n *\n * `ParshaEvent` is for regular Parashat HaShavua readings. For Shabbatot\n * with holiday readings such as Shabbat Chol ha-Moed, use\n * `getHolidaysOnDate()` from `@hebcal/core`, or `getLeyningOnDate()` from\n * `@hebcal/leyning` when the display title and exact Torah readings are needed.\n */\nexport class ParshaEvent extends Event {\n /** The parsha name(s) and date this event was constructed from */\n readonly p: SedraResult;\n /**\n * Normally created by {@link calendar} (via `options.sedrot`)\n * rather than directly.\n * @param parsha result from {@link Sedra.lookup}\n * @throws {TypeError} if called with anything other than exactly one argument\n * @throws {TypeError} if `parsha` is not a valid {@link SedraResult} — it must\n * have an `HDate` and one or two parsha names\n */\n constructor(parsha: SedraResult) {\n // eslint-disable-next-line prefer-rest-params\n if (arguments.length !== 1) {\n throw new TypeError(\n `ParshaEvent constructor takes a single SedraResult argument; ` +\n `got ${arguments.length} arguments`\n );\n }\n if (\n typeof parsha !== 'object' ||\n parsha === null ||\n !Array.isArray(parsha.parsha) ||\n parsha.parsha.length === 0 ||\n parsha.parsha.length > 2 ||\n !HDate.isHDate(parsha.hdate)\n ) {\n throw new TypeError(\n `Invalid SedraResult argument: ${JSON.stringify(parsha)}`\n );\n }\n const desc = `Parashat ${parsha.parsha.join('-')}`;\n super(parsha.hdate, desc, flags.PARSHA_HASHAVUA);\n this.p = parsha;\n }\n /**\n * @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to empty locale.\n */\n override render(locale?: string): string {\n return renderParshaName(this.p.parsha, locale);\n }\n\n override basename(): string {\n return this.p.parsha.join('-');\n }\n\n override url(): string | undefined {\n const year = this.greg().getFullYear();\n if (year < 100 || year > 2999) {\n return undefined;\n }\n const dt = this.urlDateSuffix();\n const url = `https://www.hebcal.com/sedrot/${urlFriendly(this.basename())}-${dt}`;\n return this.p.il ? `${url}?i=on` : url;\n }\n\n /**\n * The date portion of {@link url}, as `YYYYMMDD` — a parsha name recurs every\n * year, so the full date is needed to identify the reading.\n */\n urlDateSuffix(): string {\n const isoDate = isoDateString(this.greg());\n return isoDate.replaceAll('-', '');\n }\n\n /** convenience function for compatibility with previous implementation */\n get parsha(): string[] {\n return this.p.parsha;\n }\n}\n"],"names":[],"mappings":";;;;;;;AAOA;;;;;;;AAOG;AACG,MAAO,WAAY,SAAQ,KAAK,CAAA;;AAE3B,IAAA,CAAC;AACV;;;;;;;AAOG;AACH,IAAA,WAAA,CAAY,MAAmB,EAAA;;AAE7B,QAAA,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;YAC1B,MAAM,IAAI,SAAS,CACjB,CAAA,6DAAA,CAA+D;AAC7D,gBAAA,CAAA,IAAA,EAAO,SAAS,CAAC,MAAM,CAAA,UAAA,CAAY,CACtC;QACH;QACA,IACE,OAAO,MAAM,KAAK,QAAQ;AAC1B,YAAA,MAAM,KAAK,IAAI;AACf,YAAA,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;AAC7B,YAAA,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC;AAC1B,YAAA,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;YACxB,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAC5B;AACA,YAAA,MAAM,IAAI,SAAS,CACjB,CAAA,8BAAA,EAAiC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA,CAAE,CAC1D;QACH;AACA,QAAA,MAAM,IAAI,GAAG,CAAA,SAAA,EAAY,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA,CAAE;QAClD,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,eAAe,CAAC;AAChD,QAAA,IAAI,CAAC,CAAC,GAAG,MAAM;IACjB;AACA;;AAEG;AACM,IAAA,MAAM,CAAC,MAAe,EAAA;QAC7B,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC;IAChD;IAES,QAAQ,GAAA;QACf,OAAO,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;IAChC;IAES,GAAG,GAAA;QACV,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE;QACtC,IAAI,IAAI,GAAG,GAAG,IAAI,IAAI,GAAG,IAAI,EAAE;AAC7B,YAAA,OAAO,SAAS;QAClB;AACA,QAAA,MAAM,EAAE,GAAG,IAAI,CAAC,aAAa,EAAE;AAC/B,QAAA,MAAM,GAAG,GAAG,CAAA,8BAAA,EAAiC,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAA,CAAA,EAAI,EAAE,EAAE;AACjF,QAAA,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,CAAA,EAAG,GAAG,CAAA,KAAA,CAAO,GAAG,GAAG;IACxC;AAEA;;;AAGG;IACH,aAAa,GAAA;QACX,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QAC1C,OAAO,OAAO,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC;IACpC;;AAGA,IAAA,IAAI,MAAM,GAAA;AACR,QAAA,OAAO,IAAI,CAAC,CAAC,CAAC,MAAM;IACtB;AACD;;"}
|
package/dist/esm/TimedEvent.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.14.
|
|
1
|
+
/*! @hebcal/core v6.14.5, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
import { Locale } from '@hebcal/hdate';
|
|
3
3
|
import { Event } from './event.js';
|
|
4
4
|
import { reformatTimeStr } from './reformatTimeStr.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimedEvent.js","sources":["../../../src/TimedEvent.ts"],"sourcesContent":["import {HDate, Locale} from '@hebcal/hdate';\nimport {CalOptions} from './CalOptions.js';\nimport {Location} from './location.js';\nimport {Event} from './event.js';\nimport {reformatTimeStr} from './reformatTimeStr.js';\nimport {Zmanim} from './zmanim.js';\nimport {holidayDesc as hdesc} from './staticHolidays.js';\nimport './locale.js'; // Adds Hebrew and Ashkenazic translations\n\nconst {HAVDALAH, CANDLE_LIGHTING} = hdesc;\n\n/**\n * Base class for events that have an associated wall-clock time and\n * geographic location — for example, candle lighting, havdalah, and\n * fast begin/end times.\n *\n * Stores both a `Date` (`eventTime`) and pre-formatted 24-hour\n * (`eventTimeStr`) and locale-aware (`fmtTime`) strings. May reference a\n * \"linked\" event such as the holiday whose candle-lighting time this\n * represents.\n */\nexport class TimedEvent extends Event {\n /** The exact moment of the event, rounded to the nearest minute */\n readonly eventTime: Date;\n /** Geographic location used to compute `eventTime` */\n readonly location: Location;\n /** 24-hour formatted time string in the location's timezone (e.g. `\"19:42\"`) */\n readonly eventTimeStr: string;\n /** Locale-aware formatted time string (e.g. `\"7:42pm\"` in US locale) */\n readonly fmtTime: string;\n /** Optional event this time is associated with (e.g. the Yom Tov being lit for) */\n readonly linkedEvent?: Event;\n /**\n * Optional length of the event in minutes. Not computed or validated by\n * this class; it's a plain count of minutes for downstream renderers\n * (e.g. `@hebcal/icalendar`) to add to the event's start wall-clock time\n * when producing a non-zero-duration `DTEND`. Undefined means no\n * duration was specified.\n */\n duration?: number;\n /**\n * Normally created by {@link calendar} rather than directly.\n * @param date Hebrew date the event occurs\n * @param desc Description (not translated)\n * @param mask optional holiday flags\n * @param eventTime the exact moment of the event\n * @param location geographic location used to format the time\n * @param linkedEvent optional event this time is associated with\n * @param options optional; `locale` and `hour12` affect {@link fmtTime}\n */\n constructor(\n date: HDate,\n desc: string,\n mask: number,\n eventTime: Date,\n location: Location,\n linkedEvent?: Event,\n options?: CalOptions\n ) {\n super(date, desc, mask);\n this.eventTime = Zmanim.roundTime(eventTime);\n this.location = location;\n const timeFormat = location.getTimeFormatter();\n this.eventTimeStr = Zmanim.formatTime(this.eventTime, timeFormat);\n const opts = {...options, location};\n this.fmtTime = reformatTimeStr(this.eventTimeStr, 'pm', opts);\n if (linkedEvent !== undefined) {\n this.linkedEvent = linkedEvent;\n }\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n render(locale?: string): string {\n return `${Locale.gettext(this.getDesc(), locale)}: ${this.fmtTime}`;\n }\n /**\n * Returns translation of \"Candle lighting\" without the time.\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n renderBrief(locale?: string): string {\n return Locale.gettext(this.getDesc(), locale);\n }\n\n getCategories(): string[] {\n const desc = this.getDesc();\n switch (desc) {\n // LIGHT_CANDLES or LIGHT_CANDLES_TZEIS\n case CANDLE_LIGHTING:\n return ['candles'];\n // YOM_TOV_ENDS\n case HAVDALAH:\n return ['havdalah'];\n // flags.MINOR_FAST or flags.MAJOR_FAST\n case hdesc.FAST_BEGINS:\n case hdesc.FAST_ENDS:\n return ['zmanim', 'fast'];\n case hdesc.SOF_ZMAN_ACHILAT_CHAMETZ:\n return ['zmanim', 'achilasChametz'];\n case hdesc.BIUR_CHAMETZ:\n return ['zmanim', 'biurChametz'];\n }\n /* NOTREACHED */\n return ['unknown'];\n }\n}\n\n/**\n * Candle-lighting event for the eve of Shabbat or a Yom Tov.\n *\n * Generated by {@link calendar} when `options.candlelighting`\n * is `true` and `options.location` is provided. By default candle lighting\n * occurs 18 minutes before sundown in the Diaspora and 20 minutes before\n * sundown in Israel (40 minutes in Jerusalem; 30 minutes in Haifa and\n * Zikhron Ya'akov), configurable via `options.candleLightingMins`.\n */\nexport class CandleLightingEvent extends TimedEvent {\n constructor(\n date: HDate,\n mask: number,\n eventTime: Date,\n location: Location,\n linkedEvent?: Event,\n options?: CalOptions\n ) {\n super(date, CANDLE_LIGHTING, mask, eventTime, location, linkedEvent, options);\n }\n\n getEmoji(): string {\n return '🕯️';\n }\n}\n\n/**\n * Havdalah event marking the end of Shabbat or a Yom Tov.\n *\n * Generated by {@link calendar} when `options.candlelighting`\n * is `true` and `options.location` is provided. By default Havdalah is\n * calculated by *tzeit hakochavim* (8.5° solar depression); pass\n * `options.havdalahMins` to use a fixed minute offset instead, or\n * `options.havdalahDeg` to use a different degree.\n */\nexport class HavdalahEvent extends TimedEvent {\n private readonly havdalahMins?: number;\n constructor(\n date: HDate,\n mask: number,\n eventTime: Date,\n location: Location,\n havdalahMins?: number,\n linkedEvent?: Event,\n options?: CalOptions\n ) {\n super(date, HAVDALAH, mask, eventTime, location, linkedEvent, options);\n if (havdalahMins) {\n this.havdalahMins = havdalahMins;\n }\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n render(locale?: string): string {\n return `${this.renderBrief(locale)}: ${this.fmtTime}`;\n }\n /**\n * Returns translation of \"Havdalah\" without the time.\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n renderBrief(locale?: string): string {\n let str = Locale.gettext(this.getDesc(), locale);\n if (this.havdalahMins) {\n const min = Locale.gettext('min', locale);\n str += ` (${this.havdalahMins} ${min})`;\n }\n return str;\n }\n\n getEmoji(): string {\n return '✨';\n }\n}\n"],"names":["hdesc"],"mappings":";;;;;;;;AASA,MAAM,EAAC,QAAQ,EAAE,eAAe,EAAC,GAAGA,WAAK;AAEzC;;;;;;;;;AASG;AACG,MAAO,UAAW,SAAQ,KAAK,CAAA;;AAE1B,IAAA,SAAS;;AAET,IAAA,QAAQ;;AAER,IAAA,YAAY;;AAEZ,IAAA,OAAO;;AAEP,IAAA,WAAW;AACpB;;;;;;AAMG;AACH,IAAA,QAAQ;AACR;;;;;;;;;AASG;AACH,IAAA,WAAA,CACE,IAAW,EACX,IAAY,EACZ,IAAY,EACZ,SAAe,EACf,QAAkB,EAClB,WAAmB,EACnB,OAAoB,EAAA;AAEpB,QAAA,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC;AAC5C,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ;AACxB,QAAA,MAAM,UAAU,GAAG,QAAQ,CAAC,gBAAgB,EAAE;AAC9C,QAAA,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;QACjE,MAAM,IAAI,GAAG,EAAC,GAAG,OAAO,EAAE,QAAQ,EAAC;AACnC,QAAA,IAAI,CAAC,OAAO,GAAG,eAAe,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC;AAC7D,QAAA,IAAI,WAAW,KAAK,SAAS,EAAE;AAC7B,YAAA,IAAI,CAAC,WAAW,GAAG,WAAW;QAChC;IACF;AACA;;AAEG;
|
|
1
|
+
{"version":3,"file":"TimedEvent.js","sources":["../../../src/TimedEvent.ts"],"sourcesContent":["import {HDate, Locale} from '@hebcal/hdate';\nimport {CalOptions} from './CalOptions.js';\nimport {Location} from './location.js';\nimport {Event} from './event.js';\nimport {reformatTimeStr} from './reformatTimeStr.js';\nimport {Zmanim} from './zmanim.js';\nimport {holidayDesc as hdesc} from './staticHolidays.js';\nimport './locale.js'; // Adds Hebrew and Ashkenazic translations\n\nconst {HAVDALAH, CANDLE_LIGHTING} = hdesc;\n\n/**\n * Base class for events that have an associated wall-clock time and\n * geographic location — for example, candle lighting, havdalah, and\n * fast begin/end times.\n *\n * Stores both a `Date` (`eventTime`) and pre-formatted 24-hour\n * (`eventTimeStr`) and locale-aware (`fmtTime`) strings. May reference a\n * \"linked\" event such as the holiday whose candle-lighting time this\n * represents.\n */\nexport class TimedEvent extends Event {\n /** The exact moment of the event, rounded to the nearest minute */\n readonly eventTime: Date;\n /** Geographic location used to compute `eventTime` */\n readonly location: Location;\n /** 24-hour formatted time string in the location's timezone (e.g. `\"19:42\"`) */\n readonly eventTimeStr: string;\n /** Locale-aware formatted time string (e.g. `\"7:42pm\"` in US locale) */\n readonly fmtTime: string;\n /** Optional event this time is associated with (e.g. the Yom Tov being lit for) */\n readonly linkedEvent?: Event;\n /**\n * Optional length of the event in minutes. Not computed or validated by\n * this class; it's a plain count of minutes for downstream renderers\n * (e.g. `@hebcal/icalendar`) to add to the event's start wall-clock time\n * when producing a non-zero-duration `DTEND`. Undefined means no\n * duration was specified.\n */\n duration?: number;\n /**\n * Normally created by {@link calendar} rather than directly.\n * @param date Hebrew date the event occurs\n * @param desc Description (not translated)\n * @param mask optional holiday flags\n * @param eventTime the exact moment of the event\n * @param location geographic location used to format the time\n * @param linkedEvent optional event this time is associated with\n * @param options optional; `locale` and `hour12` affect {@link fmtTime}\n */\n constructor(\n date: HDate,\n desc: string,\n mask: number,\n eventTime: Date,\n location: Location,\n linkedEvent?: Event,\n options?: CalOptions\n ) {\n super(date, desc, mask);\n this.eventTime = Zmanim.roundTime(eventTime);\n this.location = location;\n const timeFormat = location.getTimeFormatter();\n this.eventTimeStr = Zmanim.formatTime(this.eventTime, timeFormat);\n const opts = {...options, location};\n this.fmtTime = reformatTimeStr(this.eventTimeStr, 'pm', opts);\n if (linkedEvent !== undefined) {\n this.linkedEvent = linkedEvent;\n }\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n override render(locale?: string): string {\n return `${Locale.gettext(this.getDesc(), locale)}: ${this.fmtTime}`;\n }\n /**\n * Returns translation of \"Candle lighting\" without the time.\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n override renderBrief(locale?: string): string {\n return Locale.gettext(this.getDesc(), locale);\n }\n\n override getCategories(): string[] {\n const desc = this.getDesc();\n switch (desc) {\n // LIGHT_CANDLES or LIGHT_CANDLES_TZEIS\n case CANDLE_LIGHTING:\n return ['candles'];\n // YOM_TOV_ENDS\n case HAVDALAH:\n return ['havdalah'];\n // flags.MINOR_FAST or flags.MAJOR_FAST\n case hdesc.FAST_BEGINS:\n case hdesc.FAST_ENDS:\n return ['zmanim', 'fast'];\n case hdesc.SOF_ZMAN_ACHILAT_CHAMETZ:\n return ['zmanim', 'achilasChametz'];\n case hdesc.BIUR_CHAMETZ:\n return ['zmanim', 'biurChametz'];\n }\n /* NOTREACHED */\n return ['unknown'];\n }\n}\n\n/**\n * Candle-lighting event for the eve of Shabbat or a Yom Tov.\n *\n * Generated by {@link calendar} when `options.candlelighting`\n * is `true` and `options.location` is provided. By default candle lighting\n * occurs 18 minutes before sundown in the Diaspora and 20 minutes before\n * sundown in Israel (40 minutes in Jerusalem; 30 minutes in Haifa and\n * Zikhron Ya'akov), configurable via `options.candleLightingMins`.\n */\nexport class CandleLightingEvent extends TimedEvent {\n constructor(\n date: HDate,\n mask: number,\n eventTime: Date,\n location: Location,\n linkedEvent?: Event,\n options?: CalOptions\n ) {\n super(date, CANDLE_LIGHTING, mask, eventTime, location, linkedEvent, options);\n }\n\n override getEmoji(): string {\n return '🕯️';\n }\n}\n\n/**\n * Havdalah event marking the end of Shabbat or a Yom Tov.\n *\n * Generated by {@link calendar} when `options.candlelighting`\n * is `true` and `options.location` is provided. By default Havdalah is\n * calculated by *tzeit hakochavim* (8.5° solar depression); pass\n * `options.havdalahMins` to use a fixed minute offset instead, or\n * `options.havdalahDeg` to use a different degree.\n */\nexport class HavdalahEvent extends TimedEvent {\n private readonly havdalahMins?: number;\n constructor(\n date: HDate,\n mask: number,\n eventTime: Date,\n location: Location,\n havdalahMins?: number,\n linkedEvent?: Event,\n options?: CalOptions\n ) {\n super(date, HAVDALAH, mask, eventTime, location, linkedEvent, options);\n if (havdalahMins) {\n this.havdalahMins = havdalahMins;\n }\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n override render(locale?: string): string {\n return `${this.renderBrief(locale)}: ${this.fmtTime}`;\n }\n /**\n * Returns translation of \"Havdalah\" without the time.\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n override renderBrief(locale?: string): string {\n let str = Locale.gettext(this.getDesc(), locale);\n if (this.havdalahMins) {\n const min = Locale.gettext('min', locale);\n str += ` (${this.havdalahMins} ${min})`;\n }\n return str;\n }\n\n override getEmoji(): string {\n return '✨';\n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tE,IAAI,YAAY,EAAE;AAChB,YAAA,IAAI,CAAC,YAAY,GAAG,YAAY;QAClC;IACF;AACA;;AAEG;AACM,IAAA,MAAM,CAAC,MAAe,EAAA;AAC7B,QAAA,OAAO,CAAA,EAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA,EAAA,EAAK,IAAI,CAAC,OAAO,CAAA,CAAE;IACvD;AACA;;;AAGG;AACM,IAAA,WAAW,CAAC,MAAe,EAAA;AAClC,QAAA,IAAI,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC;AAChD,QAAA,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC;YACzC,GAAG,IAAI,KAAK,IAAI,CAAC,YAAY,CAAA,CAAA,EAAI,GAAG,GAAG;QACzC;AACA,QAAA,OAAO,GAAG;IACZ;IAES,QAAQ,GAAA;AACf,QAAA,OAAO,GAAG;IACZ;AACD;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.14.
|
|
1
|
+
/*! @hebcal/core v6.14.5, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
import { Locale } from '@hebcal/hdate';
|
|
3
3
|
import { flags } from './event.js';
|
|
4
4
|
import { HolidayEvent } from './HolidayEvent.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YomKippurKatanEvent.js","sources":["../../../src/YomKippurKatanEvent.ts"],"sourcesContent":["import {HDate, Locale} from '@hebcal/hdate';\nimport {flags} from './event.js';\nimport {HolidayEvent} from './HolidayEvent.js';\nimport {smartApostrophe} from './string.js';\nimport './locale.js'; // Adds Hebrew and Ashkenazic translations\n\nconst ykk = 'Yom Kippur Katan';\n\n/** YKK is minor day of atonement on the day preceeding each Rosh Chodesh */\nexport class YomKippurKatanEvent extends HolidayEvent {\n private readonly nextMonthName: string;\n /**\n * Normally created by {@link calendar} (via\n * `options.yomKippurKatan`) rather than directly.\n * @param date Hebrew date event occurs\n * @param nextMonthName name of the upcoming month\n */\n constructor(date: HDate, nextMonthName: string) {\n super(\n date,\n `${ykk} ${nextMonthName}`,\n flags.MINOR_FAST | flags.YOM_KIPPUR_KATAN\n );\n this.nextMonthName = nextMonthName;\n this.memo = `Minor Day of Atonement on the day preceeding Rosh Chodesh ${nextMonthName}`;\n }\n\n basename(): string {\n return this.getDesc();\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n render(locale?: string): string {\n const monthName0 = Locale.gettext(this.nextMonthName, locale);\n const monthName = smartApostrophe(monthName0);\n return `${Locale.gettext(ykk, locale)} ${monthName}`;\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n renderBrief(locale?: string): string {\n return Locale.gettext(ykk, locale);\n }\n\n url(): string | undefined {\n return undefined;\n }\n}\n"],"names":[],"mappings":";;;;;;;AAMA,MAAM,GAAG,GAAG,kBAAkB;AAE9B;AACM,MAAO,mBAAoB,SAAQ,YAAY,CAAA;AAClC,IAAA,aAAa;AAC9B;;;;;AAKG;IACH,WAAA,CAAY,IAAW,EAAE,aAAqB,EAAA;AAC5C,QAAA,KAAK,CACH,IAAI,EACJ,CAAA,EAAG,GAAG,IAAI,aAAa,CAAA,CAAE,EACzB,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,gBAAgB,CAC1C;AACD,QAAA,IAAI,CAAC,aAAa,GAAG,aAAa;AAClC,QAAA,IAAI,CAAC,IAAI,GAAG,CAAA,0DAAA,EAA6D,aAAa,EAAE;IAC1F;
|
|
1
|
+
{"version":3,"file":"YomKippurKatanEvent.js","sources":["../../../src/YomKippurKatanEvent.ts"],"sourcesContent":["import {HDate, Locale} from '@hebcal/hdate';\nimport {flags} from './event.js';\nimport {HolidayEvent} from './HolidayEvent.js';\nimport {smartApostrophe} from './string.js';\nimport './locale.js'; // Adds Hebrew and Ashkenazic translations\n\nconst ykk = 'Yom Kippur Katan';\n\n/** YKK is minor day of atonement on the day preceeding each Rosh Chodesh */\nexport class YomKippurKatanEvent extends HolidayEvent {\n private readonly nextMonthName: string;\n /**\n * Normally created by {@link calendar} (via\n * `options.yomKippurKatan`) rather than directly.\n * @param date Hebrew date event occurs\n * @param nextMonthName name of the upcoming month\n */\n constructor(date: HDate, nextMonthName: string) {\n super(\n date,\n `${ykk} ${nextMonthName}`,\n flags.MINOR_FAST | flags.YOM_KIPPUR_KATAN\n );\n this.nextMonthName = nextMonthName;\n this.memo = `Minor Day of Atonement on the day preceeding Rosh Chodesh ${nextMonthName}`;\n }\n\n override basename(): string {\n return this.getDesc();\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n override render(locale?: string): string {\n const monthName0 = Locale.gettext(this.nextMonthName, locale);\n const monthName = smartApostrophe(monthName0);\n return `${Locale.gettext(ykk, locale)} ${monthName}`;\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n override renderBrief(locale?: string): string {\n return Locale.gettext(ykk, locale);\n }\n\n override url(): string | undefined {\n return undefined;\n }\n}\n"],"names":[],"mappings":";;;;;;;AAMA,MAAM,GAAG,GAAG,kBAAkB;AAE9B;AACM,MAAO,mBAAoB,SAAQ,YAAY,CAAA;AAClC,IAAA,aAAa;AAC9B;;;;;AAKG;IACH,WAAA,CAAY,IAAW,EAAE,aAAqB,EAAA;AAC5C,QAAA,KAAK,CACH,IAAI,EACJ,CAAA,EAAG,GAAG,IAAI,aAAa,CAAA,CAAE,EACzB,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,gBAAgB,CAC1C;AACD,QAAA,IAAI,CAAC,aAAa,GAAG,aAAa;AAClC,QAAA,IAAI,CAAC,IAAI,GAAG,CAAA,0DAAA,EAA6D,aAAa,EAAE;IAC1F;IAES,QAAQ,GAAA;AACf,QAAA,OAAO,IAAI,CAAC,OAAO,EAAE;IACvB;AACA;;AAEG;AACM,IAAA,MAAM,CAAC,MAAe,EAAA;AAC7B,QAAA,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC;AAC7D,QAAA,MAAM,SAAS,GAAG,eAAe,CAAC,UAAU,CAAC;AAC7C,QAAA,OAAO,CAAA,EAAG,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA,CAAA,EAAI,SAAS,CAAA,CAAE;IACtD;AACA;;AAEG;AACM,IAAA,WAAW,CAAC,MAAe,EAAA;QAClC,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC;IACpC;IAES,GAAG,GAAA;AACV,QAAA,OAAO,SAAS;IAClB;AACD;;"}
|
package/dist/esm/ashkenazi.po.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v6.14.
|
|
1
|
+
/*! @hebcal/core v6.14.5, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
var poAshkenazi = { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);", "language": "und-x-ashkenaz" }, "contexts": { "": { "Shabbat": ["Shabbos"], "Achrei Mot": ["Achrei Mos"], "Bechukotai": ["Bechukosai"], "Beha'alotcha": ["Beha’aloscha"], "Bereshit": ["Bereshis"], "Chukat": ["Chukas"], "Erev Shavuot": ["Erev Shavuos"], "Erev Sukkot": ["Erev Sukkos"], "Ki Tavo": ["Ki Savo"], "Ki Teitzei": ["Ki Seitzei"], "Ki Tisa": ["Ki Sisa"], "Matot": ["Matos"], "Pesach Shabbat Chol ha-Moed": ["Pesach Shabbos Chol ha-Moed"], "Purim Katan": ["Purim Koton"], "Rosh Hashana LaBehemot": ["Rosh Hashana LaBeheimos"], "Shabbat Chazon": ["Shabbos Chazon"], "Shabbat HaChodesh": ["Shabbos HaChodesh"], "Shabbat HaGadol": ["Shabbos HaGadol"], "Shabbat Nachamu": ["Shabbos Nachamu"], "Shabbat Parah": ["Shabbos Parah"], "Shabbat Shekalim": ["Shabbos Shekalim"], "Shabbat Shuva": ["Shabbos Shuvah"], "Shabbat Zachor": ["Shabbos Zachor"], "Shavuot": ["Shavuos"], "Shavuot I": ["Shavuos I"], "Shavuot II": ["Shavuos II"], "Shemot": ["Shemos"], "Shmini Atzeret": ["Shmini Atzeres"], "Simchat Torah": ["Simchas Torah"], "Sukkot": ["Sukkos"], "Sukkot I": ["Sukkos I"], "Sukkot II": ["Sukkos II"], "Sukkot II (CH''M)": ["Sukkos II (CH’’M)"], "Sukkot III (CH''M)": ["Sukkos III (CH’’M)"], "Sukkot IV (CH''M)": ["Sukkos IV (CH’’M)"], "Sukkot V (CH''M)": ["Sukkos V (CH’’M)"], "Sukkot VI (CH''M)": ["Sukkos VI (CH’’M)"], "Sukkot VII (Hoshana Raba)": ["Sukkos VII (Hoshana Raba)"], "Sukkot Shabbat Chol ha-Moed": ["Sukkos Shabbos Chol ha-Moed"], "Ta'anit Bechorot": ["Ta’anis Bechoros"], "Ta'anit BeHaB": ["Ta’anis BeHaB"], "Ta'anit Esther": ["Ta’anis Esther"], "Toldot": ["Toldos"], "Vaetchanan": ["Vaeschanan"], "Yitro": ["Yisro"], "Vezot Haberakhah": ["Vezos Haberakhah"], "Parashat": ["Parshas"], "Leil Selichot": ["Leil Selichos"], "Shabbat Mevarchim Chodesh": ["Shabbos Mevorchim Chodesh"], "Shabbat Shirah": ["Shabbos Shirah"], "Asara B'Tevet": ["Asara B’Teves"], "Birkat Hachamah": ["Birkas HaChamah"], "Birkat HaChamah": ["Birkas HaChamah"], "Shushan Purim Katan": ["Shushan Purim Koton"], "Alot HaShachar": ["Alos HaShachar"], "Misheyakir": ["Misheyakir"], "Misheyakir Machmir": ["Misheyakir Machmir"], "Sunrise": ["Sunrise"], "Kriat Shema, sof zeman": ["Krias Shema, sof zman"], "Tefilah, sof zeman": ["Tefilah, sof zman"], "Kriat Shema, sof zeman (MGA)": ["Krias Shema, sof zman (MGA)"], "Kriat Shema, sof zeman (GRA)": ["Krias Shema, sof zman (GRA)"], "Tefilah, sof zeman (MGA)": ["Tefilah, sof zman (MGA)"], "Tefilah, sof zeman (GRA)": ["Tefilah, sof zman (GRA)"], "Chatzot HaLailah": ["Chatzos HaLailah"], "Chatzot HaYom": ["Chatzos"], "Chatzot hayom": ["Chatzos"], "Mincha Gedolah": ["Mincha Gedolah"], "Mincha Ketanah": ["Mincha Ketanah"], "Plag HaMincha": ["Plag HaMincha"], "Sunset": ["Sunset"], "Bein HaShemashot": ["Bein HaShemashos"], "Tzeit HaKochavim": ["Tzeis HaKochavim"], "Latest Kiddush Levana": ["Latest Kiddush Levanah"], "Earliest Kiddush Levana (3 days)": ["Earliest Kiddush Levanah (3 days)"], "Earliest Kiddush Levana (7 days)": ["Earliest Kiddush Levanah (7 days)"], "Latest Kiddush Levana (Maharil)": ["Latest Kiddush Levanah (Maharil)"], "Latest Kiddush Levana (15 days)": ["Latest Kiddush Levanah (15 days)"] } } };
|
|
3
3
|
|
|
4
4
|
export { poAshkenazi as default };
|
package/dist/esm/calendar.d.ts
CHANGED
|
@@ -103,6 +103,16 @@ import { Event } from './event.js';
|
|
|
103
103
|
* * `options.addHebrewDates` - print the Hebrew date for the entire date range
|
|
104
104
|
* * `options.addHebrewDatesForEvents` - print the Hebrew date for dates with some events
|
|
105
105
|
*
|
|
106
|
+
* Events are returned in date order. Events on the same date are ordered by
|
|
107
|
+
* approximate time of day: timed events before dawn (Fast begins, an early
|
|
108
|
+
* Latest Kiddush Levana), then the parsha, special Shabbatot and minor fasts,
|
|
109
|
+
* then the Molad and Shabbat Mevarchim, then other holidays, Yizkor and the
|
|
110
|
+
* Omer, then the chametz deadlines on Erev Pesach, then daily learning, then
|
|
111
|
+
* evening holidays (Erev holidays, Chanukah), and finally the remaining timed
|
|
112
|
+
* events (candle-lighting, Havdalah, Fast ends) in order of time. When
|
|
113
|
+
* `options.addHebrewDates` or `options.addHebrewDatesForEvents` adds a Hebrew
|
|
114
|
+
* date event, it comes first.
|
|
115
|
+
*
|
|
106
116
|
* Lastly, translation and transliteration of event titles is controlled by
|
|
107
117
|
* `options.locale` and the {@link Locale} API.
|
|
108
118
|
* `@hebcal/core` supports three locales by default:
|
package/dist/esm/calendar.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/*! @hebcal/core v6.14.
|
|
1
|
+
/*! @hebcal/core v6.14.5, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
|
|
2
2
|
import './locale.js';
|
|
3
3
|
import { months, Locale, abs2greg, HDate } from '@hebcal/hdate';
|
|
4
4
|
import { makeCandleEvent, makeFastStartEnd, makeWeekdayChanukahCandleLighting } from './candles.js';
|
|
5
5
|
import { Event, flags } from './event.js';
|
|
6
6
|
import { getStartAndEnd } from './getStartAndEnd.js';
|
|
7
7
|
import { HebrewDateEvent } from './HebrewDateEvent.js';
|
|
8
|
-
import { getHolidaysForYear_, timeOfDay
|
|
8
|
+
import { getHolidaysForYear_, timeOfDay } from './holidays.js';
|
|
9
9
|
import { ParshaEvent } from './ParshaEvent.js';
|
|
10
10
|
import { getSedra } from './sedra.js';
|
|
11
11
|
import { HavdalahEvent, TimedEvent } from './TimedEvent.js';
|
|
@@ -122,6 +122,16 @@ import { DEG_8_POINT_5, DEG_7_POINT_083 } from './zenith.js';
|
|
|
122
122
|
* * `options.addHebrewDates` - print the Hebrew date for the entire date range
|
|
123
123
|
* * `options.addHebrewDatesForEvents` - print the Hebrew date for dates with some events
|
|
124
124
|
*
|
|
125
|
+
* Events are returned in date order. Events on the same date are ordered by
|
|
126
|
+
* approximate time of day: timed events before dawn (Fast begins, an early
|
|
127
|
+
* Latest Kiddush Levana), then the parsha, special Shabbatot and minor fasts,
|
|
128
|
+
* then the Molad and Shabbat Mevarchim, then other holidays, Yizkor and the
|
|
129
|
+
* Omer, then the chametz deadlines on Erev Pesach, then daily learning, then
|
|
130
|
+
* evening holidays (Erev holidays, Chanukah), and finally the remaining timed
|
|
131
|
+
* events (candle-lighting, Havdalah, Fast ends) in order of time. When
|
|
132
|
+
* `options.addHebrewDates` or `options.addHebrewDatesForEvents` adds a Hebrew
|
|
133
|
+
* date event, it comes first.
|
|
134
|
+
*
|
|
125
135
|
* Lastly, translation and transliteration of event titles is controlled by
|
|
126
136
|
* `options.locale` and the {@link Locale} API.
|
|
127
137
|
* `@hebcal/core` supports three locales by default:
|
|
@@ -212,26 +222,18 @@ function calendar(options = {}) {
|
|
|
212
222
|
let candlesEv;
|
|
213
223
|
const holidays0 = holidaysYear.get(hd.toString()) || [];
|
|
214
224
|
const holidays = holidays0.filter(ev => ev.observedIn(il));
|
|
215
|
-
// On Shabbat, events tied to the morning Torah reading and announcements
|
|
216
|
-
// in synagogue come first: the parsha, special Shabbatot such as
|
|
217
|
-
// Shabbat Shekalim, then the Molad and Shabbat Mevarchim
|
|
218
225
|
if (options.sedrot && isSaturday) {
|
|
219
226
|
const parsha0 = sedra.lookup(abs);
|
|
220
227
|
if (!parsha0.chag) {
|
|
221
228
|
evts.push(new ParshaEvent(parsha0));
|
|
222
229
|
}
|
|
223
230
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
231
|
+
if (isSaturday && (options.molad || options.shabbatMevarchim)) {
|
|
232
|
+
evts.push(...makeMoladAndMevarchimChodesh(hd, options));
|
|
233
|
+
}
|
|
227
234
|
for (const ev of holidays) {
|
|
228
|
-
if (mevarchim.length && timeOfDay(ev) > TIME_OF_DAY_MEVARCHIM) {
|
|
229
|
-
evts.push(...mevarchim);
|
|
230
|
-
mevarchim = [];
|
|
231
|
-
}
|
|
232
235
|
candlesEv = appendHolidayAndRelated(candlesEv, evts, ev, options, isFriday, isSaturday, hasUserMask);
|
|
233
236
|
}
|
|
234
|
-
evts.push(...mevarchim);
|
|
235
237
|
const mm = hd.getMonth();
|
|
236
238
|
const dd = hd.getDate();
|
|
237
239
|
// When Erev Pesach falls on Shabbat, burning chametz is moved to Friday.
|
|
@@ -297,9 +299,10 @@ function calendar(options = {}) {
|
|
|
297
299
|
kiddushLevanaEv = makeKiddushLevanaEvent(hyear, mm, options);
|
|
298
300
|
}
|
|
299
301
|
if (kiddushLevanaEv?.getDate().abs() === abs) {
|
|
300
|
-
|
|
302
|
+
evts.push(kiddushLevanaEv);
|
|
301
303
|
}
|
|
302
304
|
}
|
|
305
|
+
sortByTimeOfDay(evts, prevEventsLength);
|
|
303
306
|
if (options.addHebrewDates ||
|
|
304
307
|
(options.addHebrewDatesForEvents &&
|
|
305
308
|
prevEventsLength !== evts.length - numDailyLearning)) {
|
|
@@ -605,22 +608,28 @@ function setOptionsFromMask(options) {
|
|
|
605
608
|
options.kiddushLevanaMaharil = true;
|
|
606
609
|
return m;
|
|
607
610
|
}
|
|
611
|
+
function compareTimeOfDay(a, b) {
|
|
612
|
+
const diff = timeOfDay(a) - timeOfDay(b);
|
|
613
|
+
if (diff !== 0) {
|
|
614
|
+
return diff;
|
|
615
|
+
}
|
|
616
|
+
if (a instanceof TimedEvent && b instanceof TimedEvent) {
|
|
617
|
+
return a.eventTime.getTime() - b.eventTime.getTime();
|
|
618
|
+
}
|
|
619
|
+
return 0;
|
|
620
|
+
}
|
|
608
621
|
/**
|
|
609
|
-
*
|
|
610
|
-
*
|
|
611
|
-
*
|
|
612
|
-
* at candle-lighting or late at night, so its position can't be fixed.
|
|
622
|
+
* Sorts today's events (those at index `start` and beyond) in place by
|
|
623
|
+
* {@link timeOfDay}. The sort is stable, so events of equal rank keep the
|
|
624
|
+
* order in which they were added, e.g. Yizkor after its holiday.
|
|
613
625
|
*/
|
|
614
|
-
function
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
const other = events[i];
|
|
618
|
-
if (other instanceof TimedEvent && other.eventTime.getTime() > time) {
|
|
619
|
-
events.splice(i, 0, ev);
|
|
620
|
-
return;
|
|
621
|
-
}
|
|
626
|
+
function sortByTimeOfDay(events, start) {
|
|
627
|
+
if (events.length - start < 2) {
|
|
628
|
+
return;
|
|
622
629
|
}
|
|
623
|
-
events.
|
|
630
|
+
const today = events.splice(start);
|
|
631
|
+
today.sort(compareTimeOfDay);
|
|
632
|
+
events.push(...today);
|
|
624
633
|
}
|
|
625
634
|
/**
|
|
626
635
|
* Appends the Event `ev` to the `events` array. Also may add related
|