@hebcal/core 6.9.2 → 6.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/README.md +8 -7
  2. package/dist/bundle.js +1140 -1010
  3. package/dist/bundle.js.map +1 -1
  4. package/dist/bundle.min.js +18 -18
  5. package/dist/bundle.min.js.map +1 -1
  6. package/dist/esm/DailyLearning.js +1 -1
  7. package/dist/esm/DailyLearning.js.map +1 -1
  8. package/dist/esm/HebrewDateEvent.js +1 -1
  9. package/dist/esm/HebrewDateEvent.js.map +1 -1
  10. package/dist/esm/HolidayEvent.js +3 -3
  11. package/dist/esm/HolidayEvent.js.map +1 -1
  12. package/dist/esm/MevarchimChodeshEvent.js +1 -1
  13. package/dist/esm/MevarchimChodeshEvent.js.map +1 -1
  14. package/dist/esm/ParshaEvent.js +1 -1
  15. package/dist/esm/ParshaEvent.js.map +1 -1
  16. package/dist/esm/TimedEvent.d.ts +8 -0
  17. package/dist/esm/TimedEvent.js +9 -1
  18. package/dist/esm/TimedEvent.js.map +1 -1
  19. package/dist/esm/YomKippurKatanEvent.js +1 -1
  20. package/dist/esm/YomKippurKatanEvent.js.map +1 -1
  21. package/dist/esm/ashkenazi.po.js +1 -1
  22. package/dist/esm/ashkenazi.po.js.map +1 -1
  23. package/dist/esm/calendar.js +15 -12
  24. package/dist/esm/calendar.js.map +1 -1
  25. package/dist/esm/candles.js +7 -7
  26. package/dist/esm/candles.js.map +1 -1
  27. package/dist/esm/cities.json.js +1 -1
  28. package/dist/esm/cities.json.js.map +1 -1
  29. package/dist/esm/event.d.ts +47 -0
  30. package/dist/esm/event.js +63 -4
  31. package/dist/esm/event.js.map +1 -1
  32. package/dist/esm/getStartAndEnd.js +1 -1
  33. package/dist/esm/getStartAndEnd.js.map +1 -1
  34. package/dist/esm/hallel.js +3 -5
  35. package/dist/esm/hallel.js.map +1 -1
  36. package/dist/esm/he-x-NoNikud.po.js +1 -1
  37. package/dist/esm/he-x-NoNikud.po.js.map +1 -1
  38. package/dist/esm/he.po.js +1 -1
  39. package/dist/esm/he.po.js.map +1 -1
  40. package/dist/esm/hebcal.d.ts +2 -2
  41. package/dist/esm/hebcal.js +4 -5
  42. package/dist/esm/hebcal.js.map +1 -1
  43. package/dist/esm/holidays.js +2 -2
  44. package/dist/esm/holidays.js.map +1 -1
  45. package/dist/esm/index.d.ts +8 -8
  46. package/dist/esm/index.js +1 -1
  47. package/dist/esm/isAssurBemlacha.js +3 -5
  48. package/dist/esm/isAssurBemlacha.js.map +1 -1
  49. package/dist/esm/isAveilut.js +1 -1
  50. package/dist/esm/isAveilut.js.map +1 -1
  51. package/dist/esm/isFastDay.js +2 -8
  52. package/dist/esm/isFastDay.js.map +1 -1
  53. package/dist/esm/locale.js +1 -1
  54. package/dist/esm/location.js +1 -1
  55. package/dist/esm/location.js.map +1 -1
  56. package/dist/esm/modern.js +1 -1
  57. package/dist/esm/modern.js.map +1 -1
  58. package/dist/esm/molad.js +1 -1
  59. package/dist/esm/molad.js.map +1 -1
  60. package/dist/esm/moladBase.js +1 -1
  61. package/dist/esm/moladBase.js.map +1 -1
  62. package/dist/esm/moladDate.js +1 -1
  63. package/dist/esm/moladDate.js.map +1 -1
  64. package/dist/esm/omer.js +1 -1
  65. package/dist/esm/omer.js.map +1 -1
  66. package/dist/esm/parshaName.js +1 -1
  67. package/dist/esm/parshaName.js.map +1 -1
  68. package/dist/esm/parshaYear.js +1 -1
  69. package/dist/esm/parshaYear.js.map +1 -1
  70. package/dist/esm/pkgVersion.d.ts +1 -1
  71. package/dist/esm/pkgVersion.js +2 -2
  72. package/dist/esm/pkgVersion.js.map +1 -1
  73. package/dist/esm/reformatTimeStr.js +1 -1
  74. package/dist/esm/reformatTimeStr.js.map +1 -1
  75. package/dist/esm/sedra.js +1 -1
  76. package/dist/esm/sedra.js.map +1 -1
  77. package/dist/esm/sefira.json.js +1 -1
  78. package/dist/esm/sefira.json.js.map +1 -1
  79. package/dist/esm/staticHolidays.js +1 -1
  80. package/dist/esm/staticHolidays.js.map +1 -1
  81. package/dist/esm/string.js +1 -1
  82. package/dist/esm/string.js.map +1 -1
  83. package/dist/esm/tachanun.js +1 -1
  84. package/dist/esm/tachanun.js.map +1 -1
  85. package/dist/esm/zmanim.js +1 -1
  86. package/dist/esm/zmanim.js.map +1 -1
  87. package/package.json +11 -11
@@ -1 +1 @@
1
- {"version":3,"file":"holidays.js","sources":["../../../src/holidays.ts"],"sourcesContent":["/*\n Hebcal - A Jewish Calendar Generator\n Copyright (c) 1994-2020 Danny Sadinoff\n Portions copyright Eyal Schachter and Michael J. Radwin\n\n https://github.com/hebcal/hebcal-es6\n\n This program is free software; you can redistribute it and/or\n modify it under the terms of the GNU General Public License\n as published by the Free Software Foundation; either version 2\n of the License, or (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {HDate, months} from '@hebcal/hdate';\nimport QuickLRU from 'quick-lru';\nimport {flags} from './event.js';\nimport {dateYomHaShoah, dateYomHaZikaron} from './modern.js';\nimport {getSedra} from './sedra.js';\nimport {\n staticHolidays,\n staticModernHolidays,\n holidayDesc as hdesc,\n} from './staticHolidays.js';\nimport {YomKippurKatanEvent} from './YomKippurKatanEvent.js';\nimport {\n HolidayEvent,\n ChanukahEvent,\n AsaraBTevetEvent,\n RoshHashanaEvent,\n RoshChodeshEvent,\n} from './HolidayEvent.js';\n\n/**\n * Returns an array of holiday Events that occur on the given date, or\n * `undefined` if no holidays occur that day.\n *\n * When `il` is omitted, both Diaspora-only and Israel-only events are\n * returned (e.g. on the second day of a Yom Tov, both `\"Pesach II\"` for\n * Diaspora and any Israel-only events). Pass `true` or `false` to filter\n * to a single schedule.\n * @example\n * import {getHolidaysOnDate, HDate, months} from '@hebcal/core';\n * const events = getHolidaysOnDate(new HDate(15, months.NISAN, 5784), false);\n * events?.map(ev => ev.getDesc()); // ['Pesach I']\n * @param date Hebrew Date, Gregorian date, or absolute R.D. day number\n * @param [il] use the Israeli schedule for holidays\n */\nexport function getHolidaysOnDate(\n date: HDate | Date | number,\n il?: boolean\n): HolidayEvent[] | undefined {\n const hd = HDate.isHDate(date) ? (date as HDate) : new HDate(date);\n const hdStr = hd.toString();\n const yearMap = getHolidaysForYear_(hd.getFullYear());\n const events = yearMap.get(hdStr);\n // if il isn't a boolean return both diaspora + IL for day\n if (il === undefined || events === undefined) {\n return events;\n }\n const filtered = events.filter(ev => ev.observedIn(il));\n return filtered;\n}\n\nconst CHAG = flags.CHAG;\nconst IL_ONLY = flags.IL_ONLY;\nconst LIGHT_CANDLES_TZEIS = flags.LIGHT_CANDLES_TZEIS;\nconst CHANUKAH_CANDLES = flags.CHANUKAH_CANDLES;\nconst BEHAB = flags.BEHAB;\nconst MINOR_FAST = flags.MINOR_FAST;\nconst SPECIAL_SHABBAT = flags.SPECIAL_SHABBAT;\nconst MODERN_HOLIDAY = flags.MODERN_HOLIDAY;\nconst MAJOR_FAST = flags.MAJOR_FAST;\nconst MINOR_HOLIDAY = flags.MINOR_HOLIDAY;\nconst EREV = flags.EREV;\n\nconst SUN = 0;\nconst TUE = 2;\nconst THU = 4;\nconst FRI = 5;\nconst SAT = 6;\n\nconst NISAN = months.NISAN;\nconst IYYAR = months.IYYAR;\nconst TAMUZ = months.TAMUZ;\nconst AV = months.AV;\nconst TISHREI = months.TISHREI;\nconst CHESHVAN = months.CHESHVAN;\nconst KISLEV = months.KISLEV;\nconst TEVET = months.TEVET;\nconst ADAR_I = months.ADAR_I;\nconst ADAR_II = months.ADAR_II;\n\nconst emojiIsraelFlag = {emoji: '🇮🇱'} as const;\n/**\n * Holidays for an entire Hebrew year, indexed by `HDate.toString()`\n * (e.g. `'15 Nisan 5784'`). Returned by\n * {@link HebrewCalendar.getHolidaysForYear}. Because a single date can carry\n * more than one event, each key maps to an array. Entries are *not* filtered\n * by Israel vs. Diaspora — inspect `flags.IL_ONLY` / `flags.CHUL_ONLY`.\n */\nexport type HolidayYearMap = Map<string, HolidayEvent[]>;\nconst yearCache = new QuickLRU<number, HolidayYearMap>({maxSize: 120});\n\n/**\n * Lower-level holidays interface, which returns a `Map` of `Event`s indexed by\n * `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`\n * or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.\n * @private\n */\nexport function getHolidaysForYear_(year: number): HolidayYearMap {\n if (typeof year !== 'number') {\n throw new TypeError(`bad Hebrew year: ${year}`);\n }\n if (year < 1 || year > 32658) {\n throw new RangeError(`Hebrew year ${year} out of range 1-32658`);\n }\n const cached = yearCache.get(year);\n if (cached) {\n return cached;\n }\n\n const RH = new HDate(1, TISHREI, year);\n const pesach = new HDate(15, NISAN, year);\n\n const map = new Map<string, HolidayEvent[]>();\n function add(...events: HolidayEvent[]) {\n for (const ev of events) {\n const key = ev.date.toString();\n const arr = map.get(key);\n if (typeof arr === 'object') {\n if (arr[0].getFlags() & EREV) {\n arr.unshift(ev);\n } else {\n arr.push(ev);\n }\n } else {\n map.set(key, [ev]);\n }\n }\n }\n\n for (const h of staticHolidays) {\n const hd = new HDate(h.dd, h.mm, year);\n const attrs: any = {};\n if (h.emoji) attrs.emoji = h.emoji;\n if (h.chmDay) attrs.cholHaMoedDay = h.chmDay;\n const ev = new HolidayEvent(hd, h.desc, h.flags, attrs);\n add(ev);\n }\n\n // standard holidays that don't shift based on year\n add(new RoshHashanaEvent(RH, year, CHAG | LIGHT_CANDLES_TZEIS));\n\n // Variable date holidays\n const tzomGedaliahDay: number = RH.getDay() === THU ? 4 : 3;\n add(\n new HolidayEvent(\n new HDate(tzomGedaliahDay, TISHREI, year),\n hdesc.TZOM_GEDALIAH,\n MINOR_FAST\n )\n );\n // first SAT after RH\n add(\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, 7 + RH.abs())),\n hdesc.SHABBAT_SHUVA,\n SPECIAL_SHABBAT\n )\n );\n const rchTevet = HDate.shortKislev(year)\n ? new HDate(1, TEVET, year)\n : new HDate(30, KISLEV, year);\n add(new HolidayEvent(rchTevet, hdesc.CHAG_HABANOT, MINOR_HOLIDAY));\n add(\n new ChanukahEvent(\n new HDate(24, KISLEV, year),\n hdesc.CHANUKAH_1_CANDLE,\n EREV | MINOR_HOLIDAY | CHANUKAH_CANDLES,\n undefined\n )\n );\n // yes, we know Kislev 30-32 are wrong\n // HDate() corrects the month automatically\n for (let candles = 2; candles <= 8; candles++) {\n const hd = new HDate(23 + candles, KISLEV, year);\n add(\n new ChanukahEvent(\n hd,\n `Chanukah: ${candles} Candles`,\n MINOR_HOLIDAY | CHANUKAH_CANDLES,\n candles - 1\n )\n );\n }\n add(\n new ChanukahEvent(\n new HDate(32, KISLEV, year),\n hdesc.CHANUKAH_8TH_DAY,\n MINOR_HOLIDAY,\n 8\n )\n );\n add(\n new AsaraBTevetEvent(new HDate(10, TEVET, year), hdesc.ASARA_BTEVET, MINOR_FAST)\n );\n const pesachAbs = pesach.abs();\n add(\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 43)),\n hdesc.SHABBAT_SHEKALIM,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 30)),\n hdesc.SHABBAT_ZACHOR,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(pesachAbs - (pesach.getDay() === TUE ? 33 : 31)),\n hdesc.TAANIT_ESTHER,\n MINOR_FAST\n )\n );\n const haChodeshAbs = HDate.dayOnOrBefore(SAT, pesachAbs - 14);\n add(\n new HolidayEvent(\n new HDate(haChodeshAbs - 7),\n hdesc.SHABBAT_PARAH,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(haChodeshAbs),\n hdesc.SHABBAT_HACHODESH,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 1)),\n hdesc.SHABBAT_HAGADOL,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n // if the fast falls on Shabbat, move to Thursday\n pesach.prev().getDay() === SAT\n ? pesach.onOrBefore(THU)\n : new HDate(14, NISAN, year),\n hdesc.TAANIT_BECHOROT,\n MINOR_FAST\n )\n );\n add(\n new HolidayEvent(\n new HDate(\n HDate.dayOnOrBefore(SAT, new HDate(1, TISHREI, year + 1).abs() - 4)\n ),\n hdesc.LEIL_SELICHOT,\n MINOR_HOLIDAY,\n {emoji: '🕍'}\n )\n );\n\n if (pesach.getDay() === SUN) {\n add(\n new HolidayEvent(\n new HDate(16, ADAR_II, year),\n hdesc.PURIM_MESHULASH,\n MINOR_HOLIDAY\n )\n );\n }\n\n if (HDate.isLeapYear(year)) {\n add(\n new HolidayEvent(\n new HDate(14, ADAR_I, year),\n hdesc.PURIM_KATAN,\n MINOR_HOLIDAY,\n {emoji: '🎭️'}\n )\n );\n add(\n new HolidayEvent(\n new HDate(15, ADAR_I, year),\n hdesc.SHUSHAN_PURIM_KATAN,\n MINOR_HOLIDAY,\n {emoji: '🎭️'}\n )\n );\n }\n\n const nisan27dt = dateYomHaShoah(year);\n if (nisan27dt) {\n add(new HolidayEvent(nisan27dt, hdesc.YOM_HASHOAH, MODERN_HOLIDAY));\n }\n\n const yomHaZikaronDt = dateYomHaZikaron(year);\n if (yomHaZikaronDt) {\n add(\n new HolidayEvent(\n yomHaZikaronDt,\n hdesc.YOM_HAZIKARON,\n MODERN_HOLIDAY,\n emojiIsraelFlag\n ),\n new HolidayEvent(\n yomHaZikaronDt.next(),\n hdesc.YOM_HAATZMA_UT,\n MODERN_HOLIDAY,\n emojiIsraelFlag\n )\n );\n }\n\n for (const h of staticModernHolidays) {\n if (year >= h.firstYear) {\n let hd = new HDate(h.dd, h.mm, year);\n const dow = hd.getDay();\n if (h.friSatMovetoThu && (dow === FRI || dow === SAT)) {\n hd = hd.onOrBefore(THU);\n } else if (h.friPostponeToSun && dow === FRI) {\n hd = new HDate(hd.abs() + 2);\n } else if (h.satPostponeToSun && dow === SAT) {\n hd = hd.next();\n }\n const mask = h.chul ? MODERN_HOLIDAY : MODERN_HOLIDAY | IL_ONLY;\n const ev = new HolidayEvent(hd, h.desc, mask);\n if (!h.suppressEmoji) {\n ev.emoji = '🇮🇱';\n }\n add(ev);\n }\n }\n\n let tamuz17 = new HDate(17, TAMUZ, year);\n let tamuz17attrs;\n if (tamuz17.getDay() === SAT) {\n tamuz17 = new HDate(18, TAMUZ, year);\n tamuz17attrs = {observed: true};\n }\n add(new HolidayEvent(tamuz17, hdesc.TZOM_TAMMUZ, MINOR_FAST, tamuz17attrs));\n\n let av9dt = new HDate(9, AV, year);\n let av9title = hdesc.TISHA_BAV;\n let av9attrs;\n if (av9dt.getDay() === SAT) {\n av9dt = av9dt.next();\n av9attrs = {observed: true};\n av9title += ' (observed)';\n }\n const av9abs = av9dt.abs();\n add(\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, av9abs)),\n hdesc.SHABBAT_CHAZON,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n av9dt.prev(),\n hdesc.EREV_TISHA_BAV,\n EREV | MAJOR_FAST,\n av9attrs\n ),\n new HolidayEvent(av9dt, av9title, MAJOR_FAST, av9attrs),\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, av9abs + 7)),\n hdesc.SHABBAT_NACHAMU,\n SPECIAL_SHABBAT\n )\n );\n\n const monthsInYear = HDate.monthsInYear(year);\n for (let month = 1; month <= monthsInYear; month++) {\n const monthName = HDate.getMonthName(month, year);\n if (\n (month === NISAN\n ? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1)\n : HDate.daysInMonth(month - 1, year)) === 30\n ) {\n add(new RoshChodeshEvent(new HDate(1, month, year), monthName));\n add(new RoshChodeshEvent(new HDate(30, month - 1, year), monthName));\n } else if (month !== TISHREI) {\n add(new RoshChodeshEvent(new HDate(1, month, year), monthName));\n }\n }\n\n // Begin: Yom Kippur Katan\n // start at Iyyar because one may not fast during Nisan\n for (let month = months.IYYAR; month <= monthsInYear; month++) {\n const nextMonth = month + 1;\n // Yom Kippur Katan is not observed on the day before Rosh Hashanah.\n // Not observed prior to Rosh Chodesh Cheshvan because Yom Kippur has just passed.\n // Not observed before Rosh Chodesh Tevet, because that day is Hanukkah.\n if (\n nextMonth === TISHREI ||\n nextMonth === months.CHESHVAN ||\n nextMonth === TEVET\n ) {\n continue;\n }\n let ykk = new HDate(29, month, year);\n const dow = ykk.getDay();\n if (dow === FRI || dow === SAT) {\n ykk = ykk.onOrBefore(THU);\n }\n\n const nextMonthName = HDate.getMonthName(nextMonth, year);\n const ev = new YomKippurKatanEvent(ykk, nextMonthName);\n add(ev);\n }\n\n for (const month of [CHESHVAN, IYYAR]) {\n const roshChodesh = new HDate(1, month, year);\n let shabbos = new HDate(HDate.dayOnOrBefore(SAT, roshChodesh.abs() + 6));\n if (shabbos.abs() === roshChodesh.abs()) {\n shabbos = new HDate(shabbos.abs() + 7);\n }\n const fastDays = [2, 5, 9].map(offset => new HDate(shabbos.abs() + offset));\n if (month === IYYAR && fastDays[2].getDate() === 14) {\n fastDays[2] = new HDate(17, IYYAR, year);\n }\n for (const hd of fastDays) {\n add(new HolidayEvent(hd, hdesc.TAANIT_BEHAB, MINOR_FAST | BEHAB));\n }\n }\n\n const sedra = getSedra(year, false);\n const beshalachHd = sedra.find(15) as HDate;\n add(new HolidayEvent(beshalachHd, hdesc.SHABBAT_SHIRAH, SPECIAL_SHABBAT));\n\n // Birkat Hachamah appears only once every 28 years\n const birkatHaChama = getBirkatHaChama(year);\n if (birkatHaChama) {\n const hd = new HDate(birkatHaChama);\n add(new HolidayEvent(hd, hdesc.BIRKAT_HACHAMAH, MINOR_HOLIDAY, {emoji: '☀️'}));\n }\n\n yearCache.set(year, map);\n return map;\n}\n\n/**\n * Birkat Hachamah appears only once every 28 years.\n * Although almost always in Nisan, it can occur in Adar II.\n * - 27 Adar II 5461 (Gregorian year 1701)\n * - 29 Adar II 5993 (Gregorian year 2233)\n *\n * Due to drift, this will eventually slip into Iyyar\n * - 2 Iyyar 7141 (Gregorian year 3381)\n * @private\n */\nfunction getBirkatHaChama(year: number): number {\n const leap = HDate.isLeapYear(year);\n const startMonth = leap ? ADAR_II : NISAN;\n const startDay = leap ? 20 : 1;\n const baseRd = HDate.hebrew2abs(year, startMonth, startDay);\n for (let day = 0; day <= 40; day++) {\n const abs = baseRd + day;\n const elapsed = abs + 1373429;\n if (elapsed % 10227 === 172) {\n return abs;\n }\n }\n return 0;\n}\n\n/**\n * Returns a sorted array of holidays observed during the given Hebrew year,\n * filtered by Israel vs. Diaspora schedule.\n *\n * Includes Rosh Chodesh, fasts, special Shabbatot, modern holidays, etc.,\n * but does not generate candle-lighting times, Torah readings, or Omer days.\n * Use {@link calendar} for those.\n * @example\n * import {getHolidaysForYearArray} from '@hebcal/core';\n * const events = getHolidaysForYearArray(5784, false);\n * console.log(events[0].getDesc()); // 'Rosh Hashana 5784'\n * @param year Hebrew year\n * @param il use the Israeli schedule for holidays\n */\nexport function getHolidaysForYearArray(year: number, il: boolean): HolidayEvent[] {\n const yearMap = getHolidaysForYear_(year);\n const startAbs = HDate.hebrew2abs(year, TISHREI, 1);\n const endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;\n let events: HolidayEvent[] = [];\n for (let absDt = startAbs; absDt <= endAbs; absDt++) {\n const hd = new HDate(absDt);\n const holidays = yearMap.get(hd.toString());\n if (holidays) {\n const filtered: HolidayEvent[] = holidays.filter(ev => ev.observedIn(il));\n events = events.concat(filtered);\n }\n }\n return events;\n}\n"],"names":["hdesc"],"mappings":";;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAoBH;;;;;;;;;;;;;;AAcG;AACG,SAAU,iBAAiB,CAC/B,IAA2B,EAC3B,EAAY,EAAA;IAEZ,MAAM,EAA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AG,GAAG;AACxB,QAAA,MAAM,OAAO,GAAG,GAAG,GAAG,OAAO;AAC7B,QAAA,IAAI,OAAO,GAAG,KAAK,KAAK,GAAG,EAAE;AAC3B,YAAA,OAAO,GAAG;QACZ;IACF;AACA,IAAA,OAAO,CAAC;AACV;AAEA;;;;;;;;;;;;;AAaG;AACG,SAAU,uBAAuB,CAAC,IAAY,EAAE,EAAW,EAAA;AAC/D,IAAA,MAAM,OAAO,GAAG,mBAAmB,CAAC,IAAI,CAAC;AACzC,IAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AACnD,IAAA,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC;IACzD,IAAI,MAAM,GAAmB,EAAE;AAC/B,IAAA,KAAK,IAAI,KAAK,GAAG,QAAQ,EAAE,KAAK,IAAI,MAAM,EAAE,KAAK,EAAE,EAAE;AACnD,QAAA,MAAM,EAAE,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC;QAC3B,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC;QAC3C,IAAI,QAAQ,EAAE;AACZ,YAAA,MAAM,QAAQ,GAAmB,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;AACzE,YAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;QAClC;IACF;AACA,IAAA,OAAO,MAAM;AACf;;;;"}
1
+ {"version":3,"file":"holidays.js","sources":["../../../src/holidays.ts"],"sourcesContent":["/*\n Hebcal - A Jewish Calendar Generator\n Copyright (c) 1994-2020 Danny Sadinoff\n Portions copyright Eyal Schachter and Michael J. Radwin\n\n https://github.com/hebcal/hebcal-es6\n\n This program is free software; you can redistribute it and/or\n modify it under the terms of the GNU General Public License\n as published by the Free Software Foundation; either version 2\n of the License, or (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {HDate, months} from '@hebcal/hdate';\nimport QuickLRU from 'quick-lru';\nimport {flags} from './event.js';\nimport {dateYomHaShoah, dateYomHaZikaron} from './modern.js';\nimport {getSedra} from './sedra.js';\nimport {\n staticHolidays,\n staticModernHolidays,\n holidayDesc as hdesc,\n} from './staticHolidays.js';\nimport {YomKippurKatanEvent} from './YomKippurKatanEvent.js';\nimport {\n HolidayEvent,\n ChanukahEvent,\n AsaraBTevetEvent,\n RoshHashanaEvent,\n RoshChodeshEvent,\n} from './HolidayEvent.js';\n\n/**\n * Returns an array of holiday Events that occur on the given date, or\n * `undefined` if no holidays occur that day.\n *\n * When `il` is omitted, both Diaspora-only and Israel-only events are\n * returned (e.g. on the second day of a Yom Tov, both `\"Pesach II\"` for\n * Diaspora and any Israel-only events). Pass `true` or `false` to filter\n * to a single schedule.\n * @example\n * import {getHolidaysOnDate, HDate, months} from '@hebcal/core';\n * const events = getHolidaysOnDate(new HDate(15, months.NISAN, 5784), false);\n * events?.map(ev => ev.getDesc()); // ['Pesach I']\n * @param date Hebrew Date, Gregorian date, or absolute R.D. day number\n * @param [il] use the Israeli schedule for holidays\n */\nexport function getHolidaysOnDate(\n date: HDate | Date | number,\n il?: boolean\n): HolidayEvent[] | undefined {\n const hd = HDate.isHDate(date) ? (date as HDate) : new HDate(date);\n const hdStr = hd.toString();\n const yearMap = getHolidaysForYear_(hd.getFullYear());\n const events = yearMap.get(hdStr);\n // if il isn't a boolean return both diaspora + IL for day\n if (il === undefined || events === undefined) {\n return events;\n }\n const filtered = events.filter(ev => ev.observedIn(il));\n return filtered;\n}\n\nconst CHAG = flags.CHAG;\nconst IL_ONLY = flags.IL_ONLY;\nconst LIGHT_CANDLES_TZEIS = flags.LIGHT_CANDLES_TZEIS;\nconst CHANUKAH_CANDLES = flags.CHANUKAH_CANDLES;\nconst BEHAB = flags.BEHAB;\nconst MINOR_FAST = flags.MINOR_FAST;\nconst SPECIAL_SHABBAT = flags.SPECIAL_SHABBAT;\nconst MODERN_HOLIDAY = flags.MODERN_HOLIDAY;\nconst MAJOR_FAST = flags.MAJOR_FAST;\nconst MINOR_HOLIDAY = flags.MINOR_HOLIDAY;\nconst EREV = flags.EREV;\n\nconst SUN = 0;\nconst TUE = 2;\nconst THU = 4;\nconst FRI = 5;\nconst SAT = 6;\n\nconst NISAN = months.NISAN;\nconst IYYAR = months.IYYAR;\nconst TAMUZ = months.TAMUZ;\nconst AV = months.AV;\nconst TISHREI = months.TISHREI;\nconst CHESHVAN = months.CHESHVAN;\nconst KISLEV = months.KISLEV;\nconst TEVET = months.TEVET;\nconst ADAR_I = months.ADAR_I;\nconst ADAR_II = months.ADAR_II;\n\nconst emojiIsraelFlag = {emoji: '🇮🇱'} as const;\n/**\n * Holidays for an entire Hebrew year, indexed by `HDate.toString()`\n * (e.g. `'15 Nisan 5784'`). Returned by\n * {@link HebrewCalendar.getHolidaysForYear}. Because a single date can carry\n * more than one event, each key maps to an array. Entries are *not* filtered\n * by Israel vs. Diaspora — inspect `flags.IL_ONLY` / `flags.CHUL_ONLY`.\n */\nexport type HolidayYearMap = Map<string, HolidayEvent[]>;\nconst yearCache = new QuickLRU<number, HolidayYearMap>({maxSize: 120});\n\n/**\n * Lower-level holidays interface, which returns a `Map` of `Event`s indexed by\n * `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`\n * or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.\n * @private\n */\nexport function getHolidaysForYear_(year: number): HolidayYearMap {\n if (typeof year !== 'number') {\n throw new TypeError(`bad Hebrew year: ${year}`);\n }\n if (year < 1 || year > 32658) {\n throw new RangeError(`Hebrew year ${year} out of range 1-32658`);\n }\n const cached = yearCache.get(year);\n if (cached) {\n return cached;\n }\n\n const RH = new HDate(1, TISHREI, year);\n const pesach = new HDate(15, NISAN, year);\n\n const map = new Map<string, HolidayEvent[]>();\n function add(...events: HolidayEvent[]) {\n for (const ev of events) {\n const key = ev.date.toString();\n const arr = map.get(key);\n if (typeof arr === 'object') {\n if (arr[0].hasFlag('EREV')) {\n arr.unshift(ev);\n } else {\n arr.push(ev);\n }\n } else {\n map.set(key, [ev]);\n }\n }\n }\n\n for (const h of staticHolidays) {\n const hd = new HDate(h.dd, h.mm, year);\n const attrs: any = {};\n if (h.emoji) attrs.emoji = h.emoji;\n if (h.chmDay) attrs.cholHaMoedDay = h.chmDay;\n const ev = new HolidayEvent(hd, h.desc, h.flags, attrs);\n add(ev);\n }\n\n // standard holidays that don't shift based on year\n add(new RoshHashanaEvent(RH, year, CHAG | LIGHT_CANDLES_TZEIS));\n\n // Variable date holidays\n const tzomGedaliahDay: number = RH.getDay() === THU ? 4 : 3;\n add(\n new HolidayEvent(\n new HDate(tzomGedaliahDay, TISHREI, year),\n hdesc.TZOM_GEDALIAH,\n MINOR_FAST\n )\n );\n // first SAT after RH\n add(\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, 7 + RH.abs())),\n hdesc.SHABBAT_SHUVA,\n SPECIAL_SHABBAT\n )\n );\n const rchTevet = HDate.shortKislev(year)\n ? new HDate(1, TEVET, year)\n : new HDate(30, KISLEV, year);\n add(new HolidayEvent(rchTevet, hdesc.CHAG_HABANOT, MINOR_HOLIDAY));\n add(\n new ChanukahEvent(\n new HDate(24, KISLEV, year),\n hdesc.CHANUKAH_1_CANDLE,\n EREV | MINOR_HOLIDAY | CHANUKAH_CANDLES,\n undefined\n )\n );\n // yes, we know Kislev 30-32 are wrong\n // HDate() corrects the month automatically\n for (let candles = 2; candles <= 8; candles++) {\n const hd = new HDate(23 + candles, KISLEV, year);\n add(\n new ChanukahEvent(\n hd,\n `Chanukah: ${candles} Candles`,\n MINOR_HOLIDAY | CHANUKAH_CANDLES,\n candles - 1\n )\n );\n }\n add(\n new ChanukahEvent(\n new HDate(32, KISLEV, year),\n hdesc.CHANUKAH_8TH_DAY,\n MINOR_HOLIDAY,\n 8\n )\n );\n add(\n new AsaraBTevetEvent(new HDate(10, TEVET, year), hdesc.ASARA_BTEVET, MINOR_FAST)\n );\n const pesachAbs = pesach.abs();\n add(\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 43)),\n hdesc.SHABBAT_SHEKALIM,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 30)),\n hdesc.SHABBAT_ZACHOR,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(pesachAbs - (pesach.getDay() === TUE ? 33 : 31)),\n hdesc.TAANIT_ESTHER,\n MINOR_FAST\n )\n );\n const haChodeshAbs = HDate.dayOnOrBefore(SAT, pesachAbs - 14);\n add(\n new HolidayEvent(\n new HDate(haChodeshAbs - 7),\n hdesc.SHABBAT_PARAH,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(haChodeshAbs),\n hdesc.SHABBAT_HACHODESH,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, pesachAbs - 1)),\n hdesc.SHABBAT_HAGADOL,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n // if the fast falls on Shabbat, move to Thursday\n pesach.prev().getDay() === SAT\n ? pesach.onOrBefore(THU)\n : new HDate(14, NISAN, year),\n hdesc.TAANIT_BECHOROT,\n MINOR_FAST\n )\n );\n add(\n new HolidayEvent(\n new HDate(\n HDate.dayOnOrBefore(SAT, new HDate(1, TISHREI, year + 1).abs() - 4)\n ),\n hdesc.LEIL_SELICHOT,\n MINOR_HOLIDAY,\n {emoji: '🕍'}\n )\n );\n\n if (pesach.getDay() === SUN) {\n add(\n new HolidayEvent(\n new HDate(16, ADAR_II, year),\n hdesc.PURIM_MESHULASH,\n MINOR_HOLIDAY\n )\n );\n }\n\n if (HDate.isLeapYear(year)) {\n add(\n new HolidayEvent(\n new HDate(14, ADAR_I, year),\n hdesc.PURIM_KATAN,\n MINOR_HOLIDAY,\n {emoji: '🎭️'}\n )\n );\n add(\n new HolidayEvent(\n new HDate(15, ADAR_I, year),\n hdesc.SHUSHAN_PURIM_KATAN,\n MINOR_HOLIDAY,\n {emoji: '🎭️'}\n )\n );\n }\n\n const nisan27dt = dateYomHaShoah(year);\n if (nisan27dt) {\n add(new HolidayEvent(nisan27dt, hdesc.YOM_HASHOAH, MODERN_HOLIDAY));\n }\n\n const yomHaZikaronDt = dateYomHaZikaron(year);\n if (yomHaZikaronDt) {\n add(\n new HolidayEvent(\n yomHaZikaronDt,\n hdesc.YOM_HAZIKARON,\n MODERN_HOLIDAY,\n emojiIsraelFlag\n ),\n new HolidayEvent(\n yomHaZikaronDt.next(),\n hdesc.YOM_HAATZMA_UT,\n MODERN_HOLIDAY,\n emojiIsraelFlag\n )\n );\n }\n\n for (const h of staticModernHolidays) {\n if (year >= h.firstYear) {\n let hd = new HDate(h.dd, h.mm, year);\n const dow = hd.getDay();\n if (h.friSatMovetoThu && (dow === FRI || dow === SAT)) {\n hd = hd.onOrBefore(THU);\n } else if (h.friPostponeToSun && dow === FRI) {\n hd = new HDate(hd.abs() + 2);\n } else if (h.satPostponeToSun && dow === SAT) {\n hd = hd.next();\n }\n const mask = h.chul ? MODERN_HOLIDAY : MODERN_HOLIDAY | IL_ONLY;\n const ev = new HolidayEvent(hd, h.desc, mask);\n if (!h.suppressEmoji) {\n ev.emoji = '🇮🇱';\n }\n add(ev);\n }\n }\n\n let tamuz17 = new HDate(17, TAMUZ, year);\n let tamuz17attrs;\n if (tamuz17.getDay() === SAT) {\n tamuz17 = new HDate(18, TAMUZ, year);\n tamuz17attrs = {observed: true};\n }\n add(new HolidayEvent(tamuz17, hdesc.TZOM_TAMMUZ, MINOR_FAST, tamuz17attrs));\n\n let av9dt = new HDate(9, AV, year);\n let av9title = hdesc.TISHA_BAV;\n let av9attrs;\n if (av9dt.getDay() === SAT) {\n av9dt = av9dt.next();\n av9attrs = {observed: true};\n av9title += ' (observed)';\n }\n const av9abs = av9dt.abs();\n add(\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, av9abs)),\n hdesc.SHABBAT_CHAZON,\n SPECIAL_SHABBAT\n ),\n new HolidayEvent(\n av9dt.prev(),\n hdesc.EREV_TISHA_BAV,\n EREV | MAJOR_FAST,\n av9attrs\n ),\n new HolidayEvent(av9dt, av9title, MAJOR_FAST, av9attrs),\n new HolidayEvent(\n new HDate(HDate.dayOnOrBefore(SAT, av9abs + 7)),\n hdesc.SHABBAT_NACHAMU,\n SPECIAL_SHABBAT\n )\n );\n\n const monthsInYear = HDate.monthsInYear(year);\n for (let month = 1; month <= monthsInYear; month++) {\n const monthName = HDate.getMonthName(month, year);\n if (\n (month === NISAN\n ? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1)\n : HDate.daysInMonth(month - 1, year)) === 30\n ) {\n add(new RoshChodeshEvent(new HDate(1, month, year), monthName));\n add(new RoshChodeshEvent(new HDate(30, month - 1, year), monthName));\n } else if (month !== TISHREI) {\n add(new RoshChodeshEvent(new HDate(1, month, year), monthName));\n }\n }\n\n // Begin: Yom Kippur Katan\n // start at Iyyar because one may not fast during Nisan\n for (let month = months.IYYAR; month <= monthsInYear; month++) {\n const nextMonth = month + 1;\n // Yom Kippur Katan is not observed on the day before Rosh Hashanah.\n // Not observed prior to Rosh Chodesh Cheshvan because Yom Kippur has just passed.\n // Not observed before Rosh Chodesh Tevet, because that day is Hanukkah.\n if (\n nextMonth === TISHREI ||\n nextMonth === months.CHESHVAN ||\n nextMonth === TEVET\n ) {\n continue;\n }\n let ykk = new HDate(29, month, year);\n const dow = ykk.getDay();\n if (dow === FRI || dow === SAT) {\n ykk = ykk.onOrBefore(THU);\n }\n\n const nextMonthName = HDate.getMonthName(nextMonth, year);\n const ev = new YomKippurKatanEvent(ykk, nextMonthName);\n add(ev);\n }\n\n for (const month of [CHESHVAN, IYYAR]) {\n const roshChodesh = new HDate(1, month, year);\n let shabbos = new HDate(HDate.dayOnOrBefore(SAT, roshChodesh.abs() + 6));\n if (shabbos.abs() === roshChodesh.abs()) {\n shabbos = new HDate(shabbos.abs() + 7);\n }\n const fastDays = [2, 5, 9].map(offset => new HDate(shabbos.abs() + offset));\n if (month === IYYAR && fastDays[2].getDate() === 14) {\n fastDays[2] = new HDate(17, IYYAR, year);\n }\n for (const hd of fastDays) {\n add(new HolidayEvent(hd, hdesc.TAANIT_BEHAB, MINOR_FAST | BEHAB));\n }\n }\n\n const sedra = getSedra(year, false);\n const beshalachHd = sedra.find(15) as HDate;\n add(new HolidayEvent(beshalachHd, hdesc.SHABBAT_SHIRAH, SPECIAL_SHABBAT));\n\n // Birkat Hachamah appears only once every 28 years\n const birkatHaChama = getBirkatHaChama(year);\n if (birkatHaChama) {\n const hd = new HDate(birkatHaChama);\n add(new HolidayEvent(hd, hdesc.BIRKAT_HACHAMAH, MINOR_HOLIDAY, {emoji: '☀️'}));\n }\n\n yearCache.set(year, map);\n return map;\n}\n\n/**\n * Birkat Hachamah appears only once every 28 years.\n * Although almost always in Nisan, it can occur in Adar II.\n * - 27 Adar II 5461 (Gregorian year 1701)\n * - 29 Adar II 5993 (Gregorian year 2233)\n *\n * Due to drift, this will eventually slip into Iyyar\n * - 2 Iyyar 7141 (Gregorian year 3381)\n * @private\n */\nfunction getBirkatHaChama(year: number): number {\n const leap = HDate.isLeapYear(year);\n const startMonth = leap ? ADAR_II : NISAN;\n const startDay = leap ? 20 : 1;\n const baseRd = HDate.hebrew2abs(year, startMonth, startDay);\n for (let day = 0; day <= 40; day++) {\n const abs = baseRd + day;\n const elapsed = abs + 1373429;\n if (elapsed % 10227 === 172) {\n return abs;\n }\n }\n return 0;\n}\n\n/**\n * Returns a sorted array of holidays observed during the given Hebrew year,\n * filtered by Israel vs. Diaspora schedule.\n *\n * Includes Rosh Chodesh, fasts, special Shabbatot, modern holidays, etc.,\n * but does not generate candle-lighting times, Torah readings, or Omer days.\n * Use {@link calendar} for those.\n * @example\n * import {getHolidaysForYearArray} from '@hebcal/core';\n * const events = getHolidaysForYearArray(5784, false);\n * console.log(events[0].getDesc()); // 'Rosh Hashana 5784'\n * @param year Hebrew year\n * @param il use the Israeli schedule for holidays\n */\nexport function getHolidaysForYearArray(year: number, il: boolean): HolidayEvent[] {\n const yearMap = getHolidaysForYear_(year);\n const startAbs = HDate.hebrew2abs(year, TISHREI, 1);\n const endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;\n let events: HolidayEvent[] = [];\n for (let absDt = startAbs; absDt <= endAbs; absDt++) {\n const hd = new HDate(absDt);\n const holidays = yearMap.get(hd.toString());\n if (holidays) {\n const filtered: HolidayEvent[] = holidays.filter(ev => ev.observedIn(il));\n events = events.concat(filtered);\n }\n }\n return events;\n}\n"],"names":["hdesc"],"mappings":";;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAoBH;;;;;;;;;;;;;;AAcG;AACG,SAAU,iBAAiB,CAC/B,IAA2B,EAC3B,EAAY,EAAA;IAEZ,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAI,IAAc,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC;AAClE,IAAA,MAAM,KAAK,GAAG,EAAE,CAAC,QAAQ,EAAE;IAC3B,MAAM,OAAO,GAAG,mBAAmB,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;IACrD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;;IAEjC,IAAI,EAAE,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,EAAE;AAC5C,QAAA,OAAO,MAAM;IACf;AACA,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,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CAAC,IAAI,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC;IACzD,IAAI,MAAM,GAAmB,EAAE;AAC/B,IAAA,KAAK,IAAI,KAAK,GAAG,QAAQ,EAAE,KAAK,IAAI,MAAM,EAAE,KAAK,EAAE,EAAE;AACnD,QAAA,MAAM,EAAE,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC;QAC3B,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC;QAC3C,IAAI,QAAQ,EAAE;AACZ,YAAA,MAAM,QAAQ,GAAmB,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;AACzE,YAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;QAClC;IACF;AACA,IAAA,OAAO,MAAM;AACf;;"}
@@ -1,10 +1,10 @@
1
1
  export { version } from './pkgVersion.js';
2
2
  export { gematriya, gematriyaStrToNum } from '@hebcal/hdate';
3
- export { greg, months, HDate, Locale, Headers, StringArrayMap, LocaleData, MonthName, } from '@hebcal/hdate';
3
+ export { greg, months, HDate, Locale, type Headers, type StringArrayMap, type LocaleData, type MonthName, } from '@hebcal/hdate';
4
4
  import './locale.js';
5
- export { CalOptions, DailyLearningValue } from './CalOptions.js';
5
+ export { type CalOptions, type DailyLearningValue } from './CalOptions.js';
6
6
  export { HebrewDateEvent } from './HebrewDateEvent.js';
7
- export { Event, flags } from './event.js';
7
+ export { Event, type FlagName, flags } from './event.js';
8
8
  export { GeoLocation, NOAACalculator } from '@hebcal/noaa';
9
9
  export { Location } from './location.js';
10
10
  export { Zmanim } from './zmanim.js';
@@ -13,16 +13,16 @@ export { isAveilut } from './isAveilut.js';
13
13
  export { isFastDay } from './isFastDay.js';
14
14
  export { TimedEvent, CandleLightingEvent, HavdalahEvent } from './TimedEvent.js';
15
15
  export { FastDayEvent, TimedChanukahEvent } from './candles.js';
16
- export { MoladBase, calculateMolad } from './moladBase.js';
16
+ export { type MoladBase, calculateMolad } from './moladBase.js';
17
17
  export { getMoladAsDate } from './moladDate.js';
18
18
  export { Molad, MoladEvent } from './molad.js';
19
- export { OmerEvent, OmerLang } from './omer.js';
20
- export { TachanunResult, tachanun } from './tachanun.js';
21
- export { Sedra, SedraResult, NumberOrString, parshiot, getSedra } from './sedra.js';
19
+ export { OmerEvent, type OmerLang } from './omer.js';
20
+ export { type TachanunResult, tachanun } from './tachanun.js';
21
+ export { Sedra, type SedraResult, type NumberOrString, parshiot, getSedra, } from './sedra.js';
22
22
  export { ParshaEvent } from './ParshaEvent.js';
23
23
  export { parshaYear } from './parshaYear.js';
24
24
  export { HolidayEvent, ChanukahEvent, AsaraBTevetEvent, RoshChodeshEvent, RoshHashanaEvent, } from './HolidayEvent.js';
25
- export { HolidayYearMap, getHolidaysOnDate } from './holidays.js';
25
+ export { type HolidayYearMap, getHolidaysOnDate } from './holidays.js';
26
26
  export { calendar } from './calendar.js';
27
27
  export { reformatTimeStr } from './reformatTimeStr.js';
28
28
  export { MevarchimChodeshEvent } from './MevarchimChodeshEvent.js';
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.9.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.10.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  export { version } from './pkgVersion.js';
3
3
  export { HDate, Locale, gematriya, gematriyaStrToNum, greg, months } from '@hebcal/hdate';
4
4
  import './locale.js';
@@ -1,15 +1,13 @@
1
- /*! @hebcal/core v6.9.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.10.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { getPseudoISO, HDate } from '@hebcal/hdate';
3
3
  import { Zmanim } from './zmanim.js';
4
4
  import { getHolidaysOnDate } from './holidays.js';
5
- import { flags } from './event.js';
6
5
 
7
- const LIGHT_CANDLES = flags.LIGHT_CANDLES | flags.LIGHT_CANDLES_TZEIS;
8
6
  function isTomorrowShabbosOrYomTov(dow, events) {
9
7
  if (dow === 5) {
10
8
  return true;
11
9
  }
12
- const erev = events.find(ev => ev.getFlags() & LIGHT_CANDLES);
10
+ const erev = events.find(ev => ev.hasAnyFlag('LIGHT_CANDLES', 'LIGHT_CANDLES_TZEIS'));
13
11
  if (erev) {
14
12
  return true;
15
13
  }
@@ -27,7 +25,7 @@ function isTodayAssurBemelacha(dow, events) {
27
25
  if (dow === 6) {
28
26
  return true;
29
27
  }
30
- const chag = events.find(ev => ev.getFlags() & flags.CHAG);
28
+ const chag = events.find(ev => ev.hasFlag('CHAG'));
31
29
  if (chag) {
32
30
  return true;
33
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"isAssurBemlacha.js","sources":["../../../src/isAssurBemlacha.ts"],"sourcesContent":["import {HDate, getPseudoISO} from '@hebcal/hdate';\nimport {Zmanim} from './zmanim.js';\nimport {Location} from './location.js';\nimport {getHolidaysOnDate} from './holidays.js';\nimport {Event, flags} from './event.js';\n\nconst LIGHT_CANDLES = flags.LIGHT_CANDLES | flags.LIGHT_CANDLES_TZEIS;\n\nfunction isTomorrowShabbosOrYomTov(dow: number, events: Event[]): boolean {\n if (dow === 5) {\n return true;\n }\n const erev = events.find(ev => ev.getFlags() & LIGHT_CANDLES);\n if (erev) {\n return true;\n }\n return false;\n}\n\n/**\n * Returns true if it is _Shabbos_ or if it is a _Yom Tov_ day that has a\n * _melacha_ (work) prohibition.\n *\n * @param dow day of week, where `6` is Shabbos\n * @param events events occurring on the day\n * @return `true` if the day is a _Yom Tov_ that is _assur bemlacha_, or _Shabbos_\n */\nfunction isTodayAssurBemelacha(dow: number, events: Event[]): boolean {\n if (dow === 6) {\n return true;\n }\n const chag = events.find(ev => ev.getFlags() & flags.CHAG);\n if (chag) {\n return true;\n }\n return false;\n}\n\n/**\n * Returns `true` if the given moment (date + time) falls within a period\n * when *melacha* (work) is prohibited — i.e. Shabbat or a Yom Tov.\n *\n * The Shabbat/Yom Tov window is taken to begin at sunset (shkiah) on the\n * preceding day (Erev Shabbat / Erev Yom Tov / Yom Tov sheni) and to end\n * at *tzais* (nightfall) on the day itself. *Tzais* is calculated using a\n * solar depression of 8.5° for simplicity; consult a halachic authority\n * for more stringent opinions.\n *\n * `useElevation` controls whether the location's elevation is taken into\n * account when computing sunset (it has no effect on the degree-based\n * tzais calculation). The Israel/Diaspora schedule comes from\n * `location.getIsrael()`.\n *\n * Throws if sunset cannot be calculated for the given location\n * (e.g. polar regions).\n * @example\n * import {isAssurBemlacha, Location} from '@hebcal/core';\n * const loc = Location.lookup('Jerusalem')!;\n * // Friday after sunset:\n * isAssurBemlacha(new Date('2024-04-26T18:00:00Z'), loc, false); // true\n * @param currentTime the moment to test (with hour/minute)\n * @param location geographic location (also supplies Israel/Diaspora flag and tzid)\n * @param useElevation include elevation when computing sunset\n * @return `true` if *melacha* is prohibited, `false` if it is not\n */\nexport function isAssurBemlacha(\n currentTime: Date,\n location: Location,\n useElevation: boolean\n): boolean {\n // Determine the calendar date in the location's timezone, not the\n // timezone of the computer running this code. Otherwise the day-of-week,\n // Hebrew date and sunset/tzais times would depend on the machine's\n // local timezone, giving different (incorrect) results near midnight.\n const isoDate = getPseudoISO(location.getTzid(), currentTime);\n const year = parseInt(isoDate.substring(0, 4), 10);\n const month = parseInt(isoDate.substring(5, 7), 10);\n const day = parseInt(isoDate.substring(8, 10), 10);\n const hd = new HDate(new Date(year, month - 1, day));\n const zmanim = new Zmanim(location, hd, useElevation);\n // erev shabbos, YT or YT sheni and after shkiah\n const sunset = zmanim.sunset();\n const sunsetMillis = sunset.getTime();\n if (isNaN(sunsetMillis)) {\n throw new Error('Could not determine sunset');\n }\n // erev shabbos, YT or YT sheni and after shkiah\n const il = location.getIsrael();\n const currentMillis = currentTime.getTime();\n const dow = hd.getDay();\n const events = getHolidaysOnDate(hd, il) || [];\n if (isTomorrowShabbosOrYomTov(dow, events) && currentMillis >= sunsetMillis) {\n return true;\n }\n // is shabbos or YT and it is before tzais\n if (isTodayAssurBemelacha(dow, events)) {\n const tzais = zmanim.tzeit();\n const tzaisMillis = tzais.getTime();\n return currentMillis <= tzaisMillis;\n }\n return false;\n}\n"],"names":[],"mappings":";;;;;;AAMA,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,mBAAmB;AAErE,SAAS,yBAAyB,CAAC,GAAW,EAAE,MAAe,EAAA;AAC7D,IAAA,IAAI,GAAG,KAAK,CAAC,EAAE;AACb,QAAA,OAAO,IAAI;IACb;AACA,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,GAAG,aAAa,CAAC;IAC7D,IAAI,IAAI,EAAE;AACR,QAAA,OAAO,IAAI;IACb;AACA,IAAA,OAAO,KAAK;AACd;AAEA;;;;;;;AAOG;AACH,SAAS,qBAAqB,CAAC,GAAW,EAAE,MAAe,EAAA;AACzD,IAAA,IAAI,GAAG,KAAK,CAAC,EAAE;AACb,QAAA,OAAO,IAAI;IACb;AACA,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC;IAC1D,IAAI,IAAI,EAAE;AACR,QAAA,OAAO,IAAI;IACb;AACA,IAAA,OAAO,KAAK;AACd;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BG;SACa,eAAe,CAC7B,WAAiB,EACjB,QAAkB,EAClB,YAAqB,EAAA;;;;;IAMrB,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC;AAC7D,IAAA,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,E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KAAK;AACd;;;;"}
1
+ {"version":3,"file":"isAssurBemlacha.js","sources":["../../../src/isAssurBemlacha.ts"],"sourcesContent":["import {HDate, getPseudoISO} from '@hebcal/hdate';\nimport {Zmanim} from './zmanim.js';\nimport {Location} from './location.js';\nimport {getHolidaysOnDate} from './holidays.js';\nimport {Event} from './event.js';\n\nfunction isTomorrowShabbosOrYomTov(dow: number, events: Event[]): boolean {\n if (dow === 5) {\n return true;\n }\n const erev = events.find(ev =>\n ev.hasAnyFlag('LIGHT_CANDLES', 'LIGHT_CANDLES_TZEIS')\n );\n if (erev) {\n return true;\n }\n return false;\n}\n\n/**\n * Returns true if it is _Shabbos_ or if it is a _Yom Tov_ day that has a\n * _melacha_ (work) prohibition.\n *\n * @param dow day of week, where `6` is Shabbos\n * @param events events occurring on the day\n * @return `true` if the day is a _Yom Tov_ that is _assur bemlacha_, or _Shabbos_\n */\nfunction isTodayAssurBemelacha(dow: number, events: Event[]): boolean {\n if (dow === 6) {\n return true;\n }\n const chag = events.find(ev => ev.hasFlag('CHAG'));\n if (chag) {\n return true;\n }\n return false;\n}\n\n/**\n * Returns `true` if the given moment (date + time) falls within a period\n * when *melacha* (work) is prohibited — i.e. Shabbat or a Yom Tov.\n *\n * The Shabbat/Yom Tov window is taken to begin at sunset (shkiah) on the\n * preceding day (Erev Shabbat / Erev Yom Tov / Yom Tov sheni) and to end\n * at *tzais* (nightfall) on the day itself. *Tzais* is calculated using a\n * solar depression of 8.5° for simplicity; consult a halachic authority\n * for more stringent opinions.\n *\n * `useElevation` controls whether the location's elevation is taken into\n * account when computing sunset (it has no effect on the degree-based\n * tzais calculation). The Israel/Diaspora schedule comes from\n * `location.getIsrael()`.\n *\n * Throws if sunset cannot be calculated for the given location\n * (e.g. polar regions).\n * @example\n * import {isAssurBemlacha, Location} from '@hebcal/core';\n * const loc = Location.lookup('Jerusalem')!;\n * // Friday after sunset:\n * isAssurBemlacha(new Date('2024-04-26T18:00:00Z'), loc, false); // true\n * @param currentTime the moment to test (with hour/minute)\n * @param location geographic location (also supplies Israel/Diaspora flag and tzid)\n * @param useElevation include elevation when computing sunset\n * @return `true` if *melacha* is prohibited, `false` if it is not\n */\nexport function isAssurBemlacha(\n currentTime: Date,\n location: Location,\n useElevation: boolean\n): boolean {\n // Determine the calendar date in the location's timezone, not the\n // timezone of the computer running this code. Otherwise the day-of-week,\n // Hebrew date and sunset/tzais times would depend on the machine's\n // local timezone, giving different (incorrect) results near midnight.\n const isoDate = getPseudoISO(location.getTzid(), currentTime);\n const year = parseInt(isoDate.substring(0, 4), 10);\n const month = parseInt(isoDate.substring(5, 7), 10);\n const day = parseInt(isoDate.substring(8, 10), 10);\n const hd = new HDate(new Date(year, month - 1, day));\n const zmanim = new Zmanim(location, hd, useElevation);\n // erev shabbos, YT or YT sheni and after shkiah\n const sunset = zmanim.sunset();\n const sunsetMillis = sunset.getTime();\n if (isNaN(sunsetMillis)) {\n throw new Error('Could not determine sunset');\n }\n // erev shabbos, YT or YT sheni and after shkiah\n const il = location.getIsrael();\n const currentMillis = currentTime.getTime();\n const dow = hd.getDay();\n const events = getHolidaysOnDate(hd, il) || [];\n if (isTomorrowShabbosOrYomTov(dow, events) && currentMillis >= sunsetMillis) {\n return true;\n }\n // is shabbos or YT and it is before tzais\n if (isTodayAssurBemelacha(dow, events)) {\n const tzais = zmanim.tzeit();\n const tzaisMillis = tzais.getTime();\n return currentMillis <= tzaisMillis;\n }\n return false;\n}\n"],"names":[],"mappings":";;;;;AAMA,SAAS,yBAAyB,CAAC,GAAW,EAAE,MAAe,EAAA;AAC7D,IAAA,IAAI,GAAG,KAAK,CAAC,EAAE;AACb,QAAA,OAAO,IAAI;IACb;AACA,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,IACzB,EAAE,CAAC,UAAU,CAAC,eAAe,EAAE,qBAAqB,CAAC,CACtD;IACD,IAAI,IAAI,EAAE;AACR,QAAA,OAAO,IAAI;IACb;AACA,IAAA,OAAO,KAAK;AACd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AAC,4BAA4B,CAAC;IAC/C;;AAEA,IAAA,MAAM,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE;AAC/B,IAAA,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,EAAE;AAC3C,IAAA,MAAM,GAAG,GAAG,EAAE,CAAC,MAAM,EAAE;IACvB,MAAM,MAAM,GAAG,iBAAiB,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE;IAC9C,IAAI,yBAAyB,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,aAAa,IAAI,YAAY,EAAE;AAC3E,QAAA,OAAO,IAAI;IACb;;AAEA,IAAA,IAAI,qBAAqB,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE;AACtC,QAAA,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,EAAE;AAC5B,QAAA,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,EAAE;QACnC,OAAO,aAAa,IAAI,WAAW;IACrC;AACA,IAAA,OAAO,KAAK;AACd;;"}
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.9.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.10.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { months, HDate } from '@hebcal/hdate';
3
3
 
4
4
  const NISAN = months.NISAN;
@@ -1 +1 @@
1
- {"version":3,"file":"isAveilut.js","sources":["../../../src/isAveilut.ts"],"sourcesContent":["import {HDate, months} from '@hebcal/hdate';\n\nconst NISAN = months.NISAN;\nconst SIVAN = months.SIVAN;\nconst TAMUZ = months.TAMUZ;\nconst AV = months.AV;\nconst SAT = 6;\n\nfunction getHDate(date: HDate | Date | number): HDate {\n return HDate.isHDate(date) ? (date as HDate) : new HDate(date);\n}\n\nfunction isSefiratHaOmer(hd: HDate): boolean {\n const hyear = hd.getFullYear();\n const beginOmer = new HDate(16, NISAN, hyear).abs();\n const endOmer = new HDate(5, SIVAN, hyear).abs();\n const abs = hd.abs();\n return abs >= beginOmer && abs <= endOmer;\n}\n\nfunction isBeinHaMetzarim(hd: HDate): boolean {\n const hyear = hd.getFullYear();\n const begin = new HDate(17, TAMUZ, hyear).abs();\n const tishaBav = new HDate(9, AV, hyear);\n const end =\n tishaBav.getDay() === SAT ? new HDate(10, AV, hyear).abs() : tishaBav.abs();\n const abs = hd.abs();\n return abs >= begin && abs <= end;\n}\n\n/**\n * Returns `true` if the given date falls within a public period of communal\n * mourning — specifically:\n *\n * - **Sefirat HaOmer**: 16 Nisan through 5 Sivan (the 49 days of the Omer).\n * - **Bein HaMetzarim** (\"between the straits\"): 17 Tammuz through 9 Av\n * (10 Av when 9 Av is postponed because it falls on Shabbat).\n *\n * This is a broad helper — it does not attempt to model minhag-specific\n * exceptions within those periods (e.g. Lag BaOmer, Rosh Chodesh Iyar,\n * the distinction between Sephardic and Ashkenazic customs on which\n * portion of the Omer is observed as mourning, etc.).\n * @example\n * import {isAveilut, HDate, months} from '@hebcal/core';\n * isAveilut(new HDate(20, months.NISAN, 5784)); // true (Omer)\n * isAveilut(new HDate(25, months.TAMUZ, 5784)); // true (Three Weeks)\n * isAveilut(new HDate(15, months.AV, 5784)); // false\n * @param date Hebrew Date, Gregorian date, or absolute R.D. day number\n * @return `true` if the date is during a mourning period\n */\nexport function isAveilut(date: HDate | Date | number): boolean {\n const hd = getHDate(date);\n return isSefiratHaOmer(hd) || isBeinHaMetzarim(hd);\n}\n"],"names":[],"mappings":";;;AAEA,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK;AAC1B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK;AAC1B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK;AAC1B,MAAM,EAAE,GAAG,MAAM,CAAC,EAAE;AACpB,MAAM,GAAG,GAAG,CAAC;AAEb,SAAS,QAAQ,CAAC,IAA2B,EAAA;AAC3C,IAAA,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAI,IAAc,GAAG,IAAI,K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 {"version":3,"file":"isAveilut.js","sources":["../../../src/isAveilut.ts"],"sourcesContent":["import {HDate, months} from '@hebcal/hdate';\n\nconst NISAN = months.NISAN;\nconst SIVAN = months.SIVAN;\nconst TAMUZ = months.TAMUZ;\nconst AV = months.AV;\nconst SAT = 6;\n\nfunction getHDate(date: HDate | Date | number): HDate {\n return HDate.isHDate(date) ? (date as HDate) : new HDate(date);\n}\n\nfunction isSefiratHaOmer(hd: HDate): boolean {\n const hyear = hd.getFullYear();\n const beginOmer = new HDate(16, NISAN, hyear).abs();\n const endOmer = new HDate(5, SIVAN, hyear).abs();\n const abs = hd.abs();\n return abs >= beginOmer && abs <= endOmer;\n}\n\nfunction isBeinHaMetzarim(hd: HDate): boolean {\n const hyear = hd.getFullYear();\n const begin = new HDate(17, TAMUZ, hyear).abs();\n const tishaBav = new HDate(9, AV, hyear);\n const end =\n tishaBav.getDay() === SAT ? new HDate(10, AV, hyear).abs() : tishaBav.abs();\n const abs = hd.abs();\n return abs >= begin && abs <= end;\n}\n\n/**\n * Returns `true` if the given date falls within a public period of communal\n * mourning — specifically:\n *\n * - **Sefirat HaOmer**: 16 Nisan through 5 Sivan (the 49 days of the Omer).\n * - **Bein HaMetzarim** (\"between the straits\"): 17 Tammuz through 9 Av\n * (10 Av when 9 Av is postponed because it falls on Shabbat).\n *\n * This is a broad helper — it does not attempt to model minhag-specific\n * exceptions within those periods (e.g. Lag BaOmer, Rosh Chodesh Iyar,\n * the distinction between Sephardic and Ashkenazic customs on which\n * portion of the Omer is observed as mourning, etc.).\n * @example\n * import {isAveilut, HDate, months} from '@hebcal/core';\n * isAveilut(new HDate(20, months.NISAN, 5784)); // true (Omer)\n * isAveilut(new HDate(25, months.TAMUZ, 5784)); // true (Three Weeks)\n * isAveilut(new HDate(15, months.AV, 5784)); // false\n * @param date Hebrew Date, Gregorian date, or absolute R.D. day number\n * @return `true` if the date is during a mourning period\n */\nexport function isAveilut(date: HDate | Date | number): boolean {\n const hd = getHDate(date);\n return isSefi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GAAG,EAAE,GAAG,QAAQ,CAAC,GAAG,EAAE;AAC7E,IAAA,MAAM,GAAG,GAAG,EAAE,CAAC,GAAG,EAAE;AACpB,IAAA,OAAO,GAAG,IAAI,KAAK,IAAI,GAAG,IAAI,GAAG;AACnC;AAEA;;;;;;;;;;;;;;;;;;;AAmBG;AACG,SAAU,SAAS,CAAC,IAA2B,EAAA;AACnD,IAAA,MAAM,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC;IACzB,OAAO,eAAe,CAAC,EAAE,CAAC,IAAI,gBAAgB,CAAC,EAAE,CAAC;AACpD;;"}
@@ -1,9 +1,6 @@
1
- /*! @hebcal/core v6.9.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
- import { flags } from './event.js';
1
+ /*! @hebcal/core v6.10.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
3
2
  import { getHolidaysOnDate } from './holidays.js';
4
3
 
5
- const FAST_DAY = flags.MAJOR_FAST | flags.MINOR_FAST;
6
- const EREV = flags.EREV;
7
4
  /**
8
5
  * Returns `true` if the given date is observed as a major or minor fast day.
9
6
  *
@@ -25,10 +22,7 @@ const EREV = flags.EREV;
25
22
  */
26
23
  function isFastDay(date, il) {
27
24
  const events = getHolidaysOnDate(date, il) || [];
28
- const fastDay = events.find(ev => {
29
- const mask = ev.getFlags();
30
- return mask & FAST_DAY && !(mask & EREV);
31
- });
25
+ const fastDay = events.find(ev => ev.hasAnyFlag('MAJOR_FAST', 'MINOR_FAST') && !ev.hasFlag('EREV'));
32
26
  return Boolean(fastDay);
33
27
  }
34
28
 
@@ -1 +1 @@
1
- {"version":3,"file":"isFastDay.js","sources":["../../../src/isFastDay.ts"],"sourcesContent":["import {HDate} from '@hebcal/hdate';\nimport {flags} from './event.js';\nimport {getHolidaysOnDate} from './holidays.js';\n\nconst FAST_DAY = flags.MAJOR_FAST | flags.MINOR_FAST;\nconst EREV = flags.EREV;\n\n/**\n * Returns `true` if the given date is observed as a major or minor fast day.\n *\n * Major fasts: Yom Kippur, Tish'a B'Av.\n * Minor fasts: Tzom Gedaliah, Asara B'Tevet, Ta'anit Esther, Ta'anit\n * Bechorot, Tzom Tammuz (plus BeHaB fasts when enabled).\n *\n * Erev Tish'a B'Av — even though the fast begins at sunset — is *not*\n * counted here: only the actual fast day itself returns `true`.\n * Postponed fasts return `true` on the actual observed date (e.g. when\n * 17 Tammuz falls on Shabbat and is observed on the 18th).\n * @example\n * import {isFastDay, HDate, months} from '@hebcal/core';\n * isFastDay(new HDate(10, months.TISHREI, 5784)); // true (Yom Kippur)\n * isFastDay(new HDate(11, months.TISHREI, 5784)); // false\n * @param date Hebrew Date, Gregorian date, or absolute R.D. day number\n * @param il optional; use the Israeli schedule for holidays (default Diaspora)\n * @return `true` if the date is a major or minor fast day\n */\nexport function isFastDay(date: HDate | Date | number, il?: boolean): boolean {\n const events = getHolidaysOnDate(date, il) || [];\n const fastDay = events.find(ev => {\n const mask = ev.getFlags();\n return mask & FAST_DAY && !(mask & EREV);\n });\n return Boolean(fastDay);\n}\n"],"names":[],"mappings":";;;;AAIA,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU;AACpD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI;AAEvB;;;;;;;;;;;;;;;;;;AAkBG;AACG,SAAU,SAAS,CAAC,IAA2B,EAAE,EAAY,EAAA;IACjE,MAAM,MAAM,GAAG,iBAAiB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE;IAChD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,IAAG;AAC/B,QAAA,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,EAAE;QAC1B,OAAO,IAAI,GAAG,QAAQ,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;AAC1C,IAAA,CAAC,CAAC;AACF,IAAA,OAAO,OAAO,CAAC,OAAO,CAAC;AACzB;;;;"}
1
+ {"version":3,"file":"isFastDay.js","sources":["../../../src/isFastDay.ts"],"sourcesContent":["import {HDate} from '@hebcal/hdate';\nimport {getHolidaysOnDate} from './holidays.js';\n\n/**\n * Returns `true` if the given date is observed as a major or minor fast day.\n *\n * Major fasts: Yom Kippur, Tish'a B'Av.\n * Minor fasts: Tzom Gedaliah, Asara B'Tevet, Ta'anit Esther, Ta'anit\n * Bechorot, Tzom Tammuz (plus BeHaB fasts when enabled).\n *\n * Erev Tish'a B'Av — even though the fast begins at sunset — is *not*\n * counted here: only the actual fast day itself returns `true`.\n * Postponed fasts return `true` on the actual observed date (e.g. when\n * 17 Tammuz falls on Shabbat and is observed on the 18th).\n * @example\n * import {isFastDay, HDate, months} from '@hebcal/core';\n * isFastDay(new HDate(10, months.TISHREI, 5784)); // true (Yom Kippur)\n * isFastDay(new HDate(11, months.TISHREI, 5784)); // false\n * @param date Hebrew Date, Gregorian date, or absolute R.D. day number\n * @param il optional; use the Israeli schedule for holidays (default Diaspora)\n * @return `true` if the date is a major or minor fast day\n */\nexport function isFastDay(date: HDate | Date | number, il?: boolean): boolean {\n const events = getHolidaysOnDate(date, il) || [];\n const fastDay = events.find(\n ev => ev.hasAnyFlag('MAJOR_FAST', 'MINOR_FAST') && !ev.hasFlag('EREV')\n );\n return Boolean(fastDay);\n}\n"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;;;;;;AAkBG;AACG,SAAU,SAAS,CAAC,IAA2B,EAAE,EAAY,EAAA;IACjE,MAAM,MAAM,GAAG,iBAAiB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE;IAChD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CACzB,EAAE,IAAI,EAAE,CAAC,UAAU,CAAC,YAAY,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CACvE;AACD,IAAA,OAAO,OAAO,CAAC,OAAO,CAAC;AACzB;;"}
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.9.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.10.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { Locale } from '@hebcal/hdate';
3
3
  export { Locale } from '@hebcal/hdate';
4
4
  import poAshkenazi from './ashkenazi.po.js';
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.9.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.10.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { GeoLocation } from '@hebcal/noaa';
3
3
  import citiesJson from './cities.json.js';
4
4
  import QuickLRU from 'quick-lru';
@@ -1 +1 @@
1
- {"version":3,"file":"location.js","sources":["../../../src/location.ts"],"sourcesContent":["/*\n Hebcal - A Jewish Calendar Generator\n Copyright (c) 1994-2020 Danny Sadinoff\n Portions copyright Eyal Schachter and Michael J. Radwin\n\n https://github.com/hebcal/hebcal-es6\n\n This program is free software; you can redistribute it and/or\n modify it under the terms of the GNU General Public License\n as published by the Free Software Foundation; either version 2\n of the License, or (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {GeoLocation} from '@hebcal/noaa';\nimport citiesJson from './cities.json.js';\nimport QuickLRU from 'quick-lru';\n\nconst classicCities = new Map<string, Location>();\n\n// Zip-Codes.com TimeZone IDs\nconst ZIPCODES_TZ_MAP: Record<string, string> = {\n '0': 'UTC',\n '4': 'America/Puerto_Rico', // Atlantic (GMT -04:00)\n '5': 'America/New_York', // Eastern (GMT -05:00)\n '6': 'America/Chicago', // Central (GMT -06:00)\n '7': 'America/Denver', // Mountain (GMT -07:00)\n '8': 'America/Los_Angeles', // Pacific (GMT -08:00)\n '9': 'America/Anchorage', // Alaska (GMT -09:00)\n '10': 'Pacific/Honolulu', // Hawaii-Aleutian Islands (GMT -10:00)\n '11': 'Pacific/Pago_Pago', // American Samoa (GMT -11:00)\n '13': 'Pacific/Funafuti', // Marshall Islands (GMT +12:00)\n '14': 'Pacific/Guam', // Guam (GMT +10:00)\n '15': 'Pacific/Palau', // Palau (GMT +9:00)\n '16': 'Pacific/Chuuk', // Micronesia (GMT +11:00)\n} as const;\n\n/** @private */\nconst timeFormatCache = new QuickLRU<string, Intl.DateTimeFormat>({\n maxSize: 120,\n});\n\n/**\n * Gets a 24-hour time formatter (e.g. 07:41 or 20:03) from cache\n * or makes a new one if needed\n * @private\n */\nfunction getFormatter(tzid: string): Intl.DateTimeFormat {\n const fmt = timeFormatCache.get(tzid);\n if (fmt) return fmt;\n const f = new Intl.DateTimeFormat('en-US', {\n timeZone: tzid,\n hour: 'numeric',\n minute: 'numeric',\n hour12: false,\n });\n timeFormatCache.set(tzid, f);\n return f;\n}\n\nfunction initClassicCities() {\n for (const entry of citiesJson) {\n const [cityName, cc, lat, lng, tzid, elev] = entry.split('|');\n const location = new Location(\n +lat,\n +lng,\n cc === 'IL',\n tzid,\n cityName,\n cc,\n undefined,\n +elev\n );\n Location.addLocation(cityName, location);\n }\n}\n\n/**\n * Class representing a geographic location for use with candle-lighting,\n * havdalah, and zmanim calculations.\n *\n * Extends {@link GeoLocation} from `@hebcal/noaa` with Jewish-calendar\n * specific data: an Israel/Diaspora flag, ISO country code, and an optional\n * geographic identifier. Also provides {@link Location.lookup} for the 65\n * built-in \"classic\" Hebcal cities.\n *\n * @example\n * import {Location} from '@hebcal/core';\n *\n * // Create a location for a custom address\n * const loc = new Location(\n * 41.85003, // latitude\n * -87.65005, // longitude\n * false, // not in Israel\n * 'America/Chicago',\n * 'Chicago, Illinois, USA',\n * 'US'\n * );\n *\n * // Or look up a built-in classic city\n * const tlv = Location.lookup('Tel Aviv');\n */\nexport class Location extends GeoLocation {\n private readonly il: boolean;\n private readonly cc?: string;\n private readonly geoid?: string | number;\n /**\n * First-level administrative division (e.g. a US state or a French\n * region) as an abbreviation, such as `\"CA\"`. Not set by this package;\n * populated by callers that hydrate a `Location` from a geo database.\n */\n admin1?: string;\n /**\n * Full name of the first-level administrative division, such as\n * `\"California\"`. Not set by this package.\n */\n stateName?: string;\n /**\n * Which kind of lookup produced this location: `'zip'` for a US Zip Code\n * or `'geoname'` for a GeoNames city. Not set by this package.\n */\n geo?: 'zip' | 'geoname';\n /** US Zip Code, such as `\"02912\"`. Not set by this package. */\n zip?: string;\n /** Approximate population of the city. Not set by this package. */\n population?: number;\n /** City name in plain ASCII, for sorting or URL generation. Not set by this package. */\n asciiname?: string;\n\n /**\n * Initialize a Location instance\n * @param latitude - Latitude as a decimal, valid range -90 thru +90 (e.g. 41.85003)\n * @param longitude - Longitude as a decimal, valid range -180 thru +180 (e.g. -87.65005)\n * @param il - in Israel (true) or Diaspora (false)\n * @param tzid - Olson timezone ID, e.g. \"America/Chicago\"\n * @param [cityName] - optional descriptive city name\n * @param [countryCode] - ISO 3166 alpha-2 country code (e.g. \"FR\")\n * @param [geoid] - optional string or numeric geographic ID\n * @param [elevation] - in meters (default `0`)\n */\n constructor(\n latitude: number,\n longitude: number,\n il: boolean,\n tzid: string,\n cityName?: string,\n countryCode?: string,\n geoid?: string | number,\n elevation?: number\n ) {\n const lat = typeof latitude === 'number' ? latitude : parseFloat(latitude);\n if (isNaN(lat) || lat < -90 || lat > 90) {\n throw new RangeError(`Latitude ${latitude} out of range [-90,90]`);\n }\n const long = typeof longitude === 'number' ? longitude : parseFloat(longitude);\n if (isNaN(long) || long < -180 || long > 180) {\n throw new RangeError(`Longitude ${longitude} out of range [-180,180]`);\n }\n if (!tzid) {\n throw new RangeError('Invalid timezone');\n }\n const elev = typeof elevation === 'number' && elevation > 0 ? elevation : 0;\n if (cityName && typeof cityName !== 'string') {\n cityName = String(cityName);\n }\n super(cityName || null, lat, long, elev, tzid);\n this.il = Boolean(il);\n this.cc = countryCode;\n if (countryCode === 'IL') {\n this.il = true;\n }\n this.geoid = geoid;\n }\n\n /**\n * Returns `true` if this location is in Israel (uses the Israeli holiday\n * and Torah-reading schedule), `false` for the Diaspora.\n */\n getIsrael(): boolean {\n return this.il;\n }\n\n /**\n * Returns the full descriptive location name passed to the constructor,\n * or `null` if no name was provided.\n *\n * Note that the built-in classic cities are named by city alone, so\n * `getName()` and {@link getShortName} return the same string for them.\n * @example\n * const loc = new Location(41.85003, -87.65005, false,\n * 'America/Chicago', 'Chicago, Illinois, USA', 'US');\n * loc.getName(); // 'Chicago, Illinois, USA'\n * Location.lookup('San Francisco')?.getName(); // 'San Francisco'\n */\n getName(): string | null {\n return this.getLocationName();\n }\n\n /**\n * Returns the location name truncated at the first comma. Useful for\n * compact display where only the city name is desired.\n *\n * Special-cased so that US locations of the form `\"Washington, DC ...\"` or\n * `\"Washington, D.C., ...\"` keep the `DC` / `D.C.` suffix attached.\n * @example\n * const chi = new Location(41.85003, -87.65005, false,\n * 'America/Chicago', 'Chicago, Illinois, USA', 'US');\n * chi.getShortName(); // 'Chicago'\n * const dc = new Location(38.89511, -77.03637, false,\n * 'America/New_York', 'Washington, D.C., USA', 'US');\n * dc.getShortName(); // 'Washington, D.C.'\n */\n getShortName(): string | null {\n const name = this.getLocationName();\n if (!name) return name;\n const comma = name.indexOf(', ');\n if (comma === -1) return name;\n if (this.cc === 'US' && name[comma + 2] === 'D') {\n if (name[comma + 3] === 'C') {\n return name.substring(0, comma + 4);\n }\n if (name[comma + 3] === '.' && name[comma + 4] === 'C') {\n return name.substring(0, comma + 6);\n }\n }\n return name.substring(0, comma);\n }\n\n /**\n * Returns the ISO 3166 alpha-2 country code (e.g. `\"US\"`, `\"IL\"`, `\"FR\"`)\n * passed to the constructor, or `undefined` if none was provided.\n */\n getCountryCode(): string | undefined {\n return this.cc;\n }\n\n /**\n * Returns the Olson timezone identifier (e.g. `\"America/Chicago\"`).\n * Alias for `getTimeZone()` from the parent `GeoLocation` class.\n */\n getTzid(): string {\n return this.getTimeZone();\n }\n\n /**\n * Returns a cached 24-hour `Intl.DateTimeFormat` (e.g. `07:41` or `20:03`)\n * configured for this location's timezone. Formatters are memoized by\n * timezone so repeated calls do not allocate.\n * @example\n * const loc = Location.lookup('Tel Aviv')!;\n * const fmt = loc.getTimeFormatter();\n * fmt.format(new Date()); // e.g. '18:42'\n */\n getTimeFormatter(): Intl.DateTimeFormat {\n return getFormatter(this.getTimeZone());\n }\n\n /**\n * Returns the optional geographic identifier passed to the constructor\n * (typically a GeoNames numeric ID or a US Zip Code string), or\n * `undefined` if none was provided.\n */\n getGeoId(): string | number | undefined {\n return this.geoid;\n }\n\n /**\n * Creates a location object from one of 65 \"classic\" Hebcal city names.\n * The following city names are supported:\n * 'Ashdod', 'Atlanta', 'Austin', 'Baghdad', 'Beer Sheva',\n * 'Berlin', 'Baltimore', 'Bogota', 'Boston', 'Budapest',\n * 'Buenos Aires', 'Buffalo', 'Chicago', 'Cincinnati', 'Cleveland',\n * 'Dallas', 'Denver', 'Detroit', 'Eilat', 'Gibraltar', 'Haifa',\n * 'Hawaii', 'Helsinki', 'Houston', 'Jerusalem', 'Johannesburg',\n * 'Kiev', 'La Paz', 'Livingston', 'Las Vegas', 'London', 'Los Angeles',\n * 'Marseilles', 'Miami', 'Minneapolis', 'Melbourne', 'Mexico City',\n * 'Montreal', 'Moscow', 'New York', 'Omaha', 'Ottawa', 'Panama City',\n * 'Paris', 'Pawtucket', 'Petach Tikvah', 'Philadelphia', 'Phoenix',\n * 'Pittsburgh', 'Providence', 'Portland', 'Saint Louis', 'Saint Petersburg',\n * 'San Diego', 'San Francisco', 'Sao Paulo', 'Seattle', 'Sydney',\n * 'Tel Aviv', 'Tiberias', 'Toronto', 'Vancouver', 'White Plains',\n * 'Washington DC', 'Worcester'\n *\n * Lookups are case-insensitive. Returns `undefined` if the name is not\n * recognized. The list can be extended with {@link Location.addLocation}.\n * @example\n * const loc = Location.lookup('San Francisco');\n * console.log(loc?.getTzid()); // 'America/Los_Angeles'\n * @param name case-insensitive classic city name\n */\n static lookup(name: string): Location | undefined {\n if (classicCities.size === 0) {\n initClassicCities();\n }\n return classicCities.get(name.toLowerCase());\n }\n\n /**\n * Returns a JSON-serialized representation of this Location.\n * Useful for debugging and structured logging.\n */\n toString(): string {\n return JSON.stringify(this);\n }\n\n /**\n * Converts a legacy Hebcal-style timezone (a numeric GMT offset plus a\n * coarse DST region) to a standard IANA/Olson timezone ID.\n *\n * This exists to migrate data from older Hebcal versions that stored\n * timezones as GMT offset + DST scheme rather than as a full tzid.\n * @example\n * Location.legacyTzToTzid(2, 'israel'); // 'Asia/Jerusalem'\n * Location.legacyTzToTzid(0, 'eu'); // 'Europe/London'\n * Location.legacyTzToTzid(0, 'none'); // 'UTC'\n * Location.legacyTzToTzid(-5, 'none'); // 'Etc/GMT-5'\n * @param tz integer, GMT offset in hours\n * @param dst 'none', 'eu', 'usa', or 'israel'\n */\n static legacyTzToTzid(tz: number, dst: string): string | undefined {\n tz = +tz;\n if (dst === 'none') {\n if (tz === 0) {\n return 'UTC';\n }\n const plus = tz > 0 ? '+' : '';\n return `Etc/GMT${plus}${tz}`;\n }\n if (tz === 2 && dst === 'israel') {\n return 'Asia/Jerusalem';\n }\n if (dst === 'eu') {\n switch (tz) {\n case -2:\n return 'Atlantic/Cape_Verde';\n case -1:\n return 'Atlantic/Azores';\n case 0:\n return 'Europe/London';\n case 1:\n return 'Europe/Paris';\n case 2:\n return 'Europe/Athens';\n default:\n break;\n }\n }\n if (dst === 'usa') {\n return ZIPCODES_TZ_MAP[String(tz * -1)];\n }\n return undefined;\n }\n\n /**\n * Converts timezone info from Zip-Codes.com to a standard Olson tzid.\n * @example\n * Location.getUsaTzid('AZ', 7, 'Y') // 'America/Denver'\n * @param state two-letter all-caps US state abbreviation like 'CA'\n * @param tz positive number, 5=America/New_York, 8=America/Los_Angeles\n * @param dst single char 'Y' or 'N'\n */\n static getUsaTzid(state: string, tz: number, dst: string): string {\n tz = +tz;\n if (tz === 10 && state === 'AK') {\n return 'America/Adak';\n }\n if (tz === 7 && state === 'AZ') {\n return dst === 'Y' ? 'America/Denver' : 'America/Phoenix';\n }\n return ZIPCODES_TZ_MAP[tz];\n }\n\n /**\n * Registers a new named location with the built-in `Location.lookup()`\n * registry. Names are stored case-insensitively. Returns `false` if a\n * location with the same (lower-cased) name is already registered, and\n * `true` if successfully added.\n *\n * Use this to extend the built-in set of 65 classic Hebcal cities with\n * your own custom locations.\n * @example\n * const tlv = new Location(32.0853, 34.7818, true,\n * 'Asia/Jerusalem', 'My Office, Tel Aviv', 'IL');\n * Location.addLocation('My Office', tlv); // true\n * Location.lookup('my office')?.getTzid(); // 'Asia/Jerusalem'\n * @param cityName name to register the location under (case insensitive)\n * @param location the `Location` instance to register\n */\n static addLocation(cityName: string, location: Location): boolean {\n const name = cityName.toLowerCase();\n if (classicCities.has(name)) {\n return false;\n }\n classicCities.set(name, location);\n return true;\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAKH,MAAM,aAAa,GAAG,IAAI,GAAG,EAAoB;AAEjD;AACA,MAAM,eAAe,GAA2B;AAC9C,IAAA,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,qBAAqB;IAC1B,GAAG,EAAE,kBAAkB;IACvB,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,gBAAgB;IACrB,GAAG,EAAE,qBAAqB;IAC1B,GAAG,EAAE,mBAAmB;IACxB,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,eAAe;CACb;AAEV;AACA,MAAM,eAAe,GAAG,IAAI,QAAQ,CAA8B;AAChE,IAAA,OAAO,EAAE,GAAG;AACb,CAAA,CAAC;AAEF;;;;AAIG;AACH,SAAS,YAAY,CAAC,IAAY,EAAA;IAChC,MAAM,GA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,EAAE,GAAG,EAAE,CAAC,CAAC;QACzC;AACA,QAAA,OAAO,SAAS;IAClB;AAEA;;;;;;;AAOG;AACH,IAAA,OAAO,UAAU,CAAC,KAAa,EAAE,EAAU,EAAE,GAAW,EAAA;QACtD,EAAE,GAAG,CAAC,EAAE;QACR,IAAI,EAAE,KAAK,EAAE,IAAI,KAAK,KAAK,IAAI,EAAE;AAC/B,YAAA,OAAO,cAAc;QACvB;QACA,IAAI,EAAE,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,EAAE;YAC9B,OAAO,GAAG,KAAK,GAAG,GAAG,gBAAgB,GAAG,iBAAiB;QAC3D;AACA,QAAA,OAAO,eAAe,CAAC,EAAE,CAAC;IAC5B;AAEA;;;;;;;;;;;;;;;AAeG;AACH,IAAA,OAAO,WAAW,CAAC,QAAgB,EAAE,QAAkB,EAAA;AACrD,QAAA,MAAM,IAAI,GAAG,QAAQ,CAAC,WAAW,EAAE;AACnC,QAAA,IAAI,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;AAC3B,YAAA,OAAO,KAAK;QACd;AACA,QAAA,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC;AACjC,QAAA,OAAO,IAAI;IACb;AACD;;;;"}
1
+ {"version":3,"file":"location.js","sources":["../../../src/location.ts"],"sourcesContent":["/*\n Hebcal - A Jewish Calendar Generator\n Copyright (c) 1994-2020 Danny Sadinoff\n Portions copyright Eyal Schachter and Michael J. Radwin\n\n https://github.com/hebcal/hebcal-es6\n\n This program is free software; you can redistribute it and/or\n modify it under the terms of the GNU General Public License\n as published by the Free Software Foundation; either version 2\n of the License, or (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {GeoLocation} from '@hebcal/noaa';\nimport citiesJson from './cities.json.js';\nimport QuickLRU from 'quick-lru';\n\nconst classicCities = new Map<string, Location>();\n\n// Zip-Codes.com TimeZone IDs\nconst ZIPCODES_TZ_MAP: Record<string, string> = {\n '0': 'UTC',\n '4': 'America/Puerto_Rico', // Atlantic (GMT -04:00)\n '5': 'America/New_York', // Eastern (GMT -05:00)\n '6': 'America/Chicago', // Central (GMT -06:00)\n '7': 'America/Denver', // Mountain (GMT -07:00)\n '8': 'America/Los_Angeles', // Pacific (GMT -08:00)\n '9': 'America/Anchorage', // Alaska (GMT -09:00)\n '10': 'Pacific/Honolulu', // Hawaii-Aleutian Islands (GMT -10:00)\n '11': 'Pacific/Pago_Pago', // American Samoa (GMT -11:00)\n '13': 'Pacific/Funafuti', // Marshall Islands (GMT +12:00)\n '14': 'Pacific/Guam', // Guam (GMT +10:00)\n '15': 'Pacific/Palau', // Palau (GMT +9:00)\n '16': 'Pacific/Chuuk', // Micronesia (GMT +11:00)\n} as const;\n\n/** @private */\nconst timeFormatCache = new QuickLRU<string, Intl.DateTimeFormat>({\n maxSize: 120,\n});\n\n/**\n * Gets a 24-hour time formatter (e.g. 07:41 or 20:03) from cache\n * or makes a new one if needed\n * @private\n */\nfunction getFormatter(tzid: string): Intl.DateTimeFormat {\n const fmt = timeFormatCache.get(tzid);\n if (fmt) return fmt;\n const f = new Intl.DateTimeFormat('en-US', {\n timeZone: tzid,\n hour: 'numeric',\n minute: 'numeric',\n hour12: false,\n });\n timeFormatCache.set(tzid, f);\n return f;\n}\n\nfunction initClassicCities() {\n for (const entry of citiesJson) {\n const [cityName, cc, lat, lng, tzid, elev] = entry.split('|');\n const location = new Location(\n +lat,\n +lng,\n cc === 'IL',\n tzid,\n cityName,\n cc,\n undefined,\n +elev\n );\n Location.addLocation(cityName, location);\n }\n}\n\n/**\n * Class representing a geographic location for use with candle-lighting,\n * havdalah, and zmanim calculations.\n *\n * Extends {@link GeoLocation} from `@hebcal/noaa` with Jewish-calendar\n * specific data: an Israel/Diaspora flag, ISO country code, and an optional\n * geographic identifier. Also provides {@link Location.lookup} for the 65\n * built-in \"classic\" Hebcal cities.\n *\n * @example\n * import {Location} from '@hebcal/core';\n *\n * // Create a location for a custom address\n * const loc = new Location(\n * 41.85003, // latitude\n * -87.65005, // longitude\n * false, // not in Israel\n * 'America/Chicago',\n * 'Chicago, Illinois, USA',\n * 'US'\n * );\n *\n * // Or look up a built-in classic city\n * const tlv = Location.lookup('Tel Aviv');\n */\nexport class Location extends GeoLocation {\n private readonly il: boolean;\n private readonly cc?: string;\n private readonly geoid?: string | number;\n /**\n * First-level administrative division (e.g. a US state or a French\n * region) as an abbreviation, such as `\"CA\"`. Not set by this package;\n * populated by callers that hydrate a `Location` from a geo database.\n */\n admin1?: string;\n /**\n * Full name of the first-level administrative division, such as\n * `\"California\"`. Not set by this package.\n */\n stateName?: string;\n /**\n * Which kind of lookup produced this location: `'zip'` for a US Zip Code\n * or `'geoname'` for a GeoNames city. Not set by this package.\n */\n geo?: 'zip' | 'geoname';\n /** US Zip Code, such as `\"02912\"`. Not set by this package. */\n zip?: string;\n /** Approximate population of the city. Not set by this package. */\n population?: number;\n /** City name in plain ASCII, for sorting or URL generation. Not set by this package. */\n asciiname?: string;\n\n /**\n * Initialize a Location instance\n * @param latitude - Latitude as a decimal, valid range -90 thru +90 (e.g. 41.85003)\n * @param longitude - Longitude as a decimal, valid range -180 thru +180 (e.g. -87.65005)\n * @param il - in Israel (true) or Diaspora (false)\n * @param tzid - Olson timezone ID, e.g. \"America/Chicago\"\n * @param [cityName] - optional descriptive city name\n * @param [countryCode] - ISO 3166 alpha-2 country code (e.g. \"FR\")\n * @param [geoid] - optional string or numeric geographic ID\n * @param [elevation] - in meters (default `0`)\n */\n constructor(\n latitude: number,\n longitude: number,\n il: boolean,\n tzid: string,\n cityName?: string,\n countryCode?: string,\n geoid?: string | number,\n elevation?: number\n ) {\n const lat = typeof latitude === 'number' ? latitude : parseFloat(latitude);\n if (isNaN(lat) || lat < -90 || lat > 90) {\n throw new RangeError(`Latitude ${latitude} out of range [-90,90]`);\n }\n const long = typeof longitude === 'number' ? longitude : parseFloat(longitude);\n if (isNaN(long) || long < -180 || long > 180) {\n throw new RangeError(`Longitude ${longitude} out of range [-180,180]`);\n }\n if (!tzid) {\n throw new RangeError('Invalid timezone');\n }\n const elev = typeof elevation === 'number' && elevation > 0 ? elevation : 0;\n if (cityName && typeof cityName !== 'string') {\n cityName = String(cityName);\n }\n super(cityName || null, lat, long, elev, tzid);\n this.il = Boolean(il);\n this.cc = countryCode;\n if (countryCode === 'IL') {\n this.il = true;\n }\n this.geoid = geoid;\n }\n\n /**\n * Returns `true` if this location is in Israel (uses the Israeli holiday\n * and Torah-reading schedule), `false` for the Diaspora.\n */\n getIsrael(): boolean {\n return this.il;\n }\n\n /**\n * Returns the full descriptive location name passed to the constructor,\n * or `null` if no name was provided.\n *\n * Note that the built-in classic cities are named by city alone, so\n * `getName()` and {@link getShortName} return the same string for them.\n * @example\n * const loc = new Location(41.85003, -87.65005, false,\n * 'America/Chicago', 'Chicago, Illinois, USA', 'US');\n * loc.getName(); // 'Chicago, Illinois, USA'\n * Location.lookup('San Francisco')?.getName(); // 'San Francisco'\n */\n getName(): string | null {\n return this.getLocationName();\n }\n\n /**\n * Returns the location name truncated at the first comma. Useful for\n * compact display where only the city name is desired.\n *\n * Special-cased so that US locations of the form `\"Washington, DC ...\"` or\n * `\"Washington, D.C., ...\"` keep the `DC` / `D.C.` suffix attached.\n * @example\n * const chi = new Location(41.85003, -87.65005, false,\n * 'America/Chicago', 'Chicago, Illinois, USA', 'US');\n * chi.getShortName(); // 'Chicago'\n * const dc = new Location(38.89511, -77.03637, false,\n * 'America/New_York', 'Washington, D.C., USA', 'US');\n * dc.getShortName(); // 'Washington, D.C.'\n */\n getShortName(): string | null {\n const name = this.getLocationName();\n if (!name) return name;\n const comma = name.indexOf(', ');\n if (comma === -1) return name;\n if (this.cc === 'US' && name[comma + 2] === 'D') {\n if (name[comma + 3] === 'C') {\n return name.substring(0, comma + 4);\n }\n if (name[comma + 3] === '.' && name[comma + 4] === 'C') {\n return name.substring(0, comma + 6);\n }\n }\n return name.substring(0, comma);\n }\n\n /**\n * Returns the ISO 3166 alpha-2 country code (e.g. `\"US\"`, `\"IL\"`, `\"FR\"`)\n * passed to the constructor, or `undefined` if none was provided.\n */\n getCountryCode(): string | undefined {\n return this.cc;\n }\n\n /**\n * Returns the Olson timezone identifier (e.g. `\"America/Chicago\"`).\n * Alias for `getTimeZone()` from the parent `GeoLocation` class.\n */\n getTzid(): string {\n return this.getTimeZone();\n }\n\n /**\n * Returns a cached 24-hour `Intl.DateTimeFormat` (e.g. `07:41` or `20:03`)\n * configured for this location's timezone. Formatters are memoized by\n * timezone so repeated calls do not allocate.\n * @example\n * const loc = Location.lookup('Tel Aviv')!;\n * const fmt = loc.getTimeFormatter();\n * fmt.format(new Date()); // e.g. '18:42'\n */\n getTimeFormatter(): Intl.DateTimeFormat {\n return getFormatter(this.getTimeZone());\n }\n\n /**\n * Returns the optional geographic identifier passed to the constructor\n * (typically a GeoNames numeric ID or a US Zip Code string), or\n * `undefined` if none was provided.\n */\n getGeoId(): string | number | undefined {\n return this.geoid;\n }\n\n /**\n * Creates a location object from one of 65 \"classic\" Hebcal city names.\n * The following city names are supported:\n * 'Ashdod', 'Atlanta', 'Austin', 'Baghdad', 'Beer Sheva',\n * 'Berlin', 'Baltimore', 'Bogota', 'Boston', 'Budapest',\n * 'Buenos Aires', 'Buffalo', 'Chicago', 'Cincinnati', 'Cleveland',\n * 'Dallas', 'Denver', 'Detroit', 'Eilat', 'Gibraltar', 'Haifa',\n * 'Hawaii', 'Helsinki', 'Houston', 'Jerusalem', 'Johannesburg',\n * 'Kiev', 'La Paz', 'Livingston', 'Las Vegas', 'London', 'Los Angeles',\n * 'Marseilles', 'Miami', 'Minneapolis', 'Melbourne', 'Mexico City',\n * 'Montreal', 'Moscow', 'New York', 'Omaha', 'Ottawa', 'Panama City',\n * 'Paris', 'Pawtucket', 'Petach Tikvah', 'Philadelphia', 'Phoenix',\n * 'Pittsburgh', 'Providence', 'Portland', 'Saint Louis', 'Saint Petersburg',\n * 'San Diego', 'San Francisco', 'Sao Paulo', 'Seattle', 'Sydney',\n * 'Tel Aviv', 'Tiberias', 'Toronto', 'Vancouver', 'White Plains',\n * 'Washington DC', 'Worcester'\n *\n * Lookups are case-insensitive. Returns `undefined` if the name is not\n * recognized. The list can be extended with {@link Location.addLocation}.\n * @example\n * const loc = Location.lookup('San Francisco');\n * console.log(loc?.getTzid()); // 'America/Los_Angeles'\n * @param name case-insensitive classic city name\n */\n static lookup(name: string): Location | undefined {\n if (classicCities.size === 0) {\n initClassicCities();\n }\n return classicCities.get(name.toLowerCase());\n }\n\n /**\n * Returns a JSON-serialized representation of this Location.\n * Useful for debugging and structured logging.\n */\n toString(): string {\n return JSON.stringify(this);\n }\n\n /**\n * Converts a legacy Hebcal-style timezone (a numeric GMT offset plus a\n * coarse DST region) to a standard IANA/Olson timezone ID.\n *\n * This exists to migrate data from older Hebcal versions that stored\n * timezones as GMT offset + DST scheme rather than as a full tzid.\n * @example\n * Location.legacyTzToTzid(2, 'israel'); // 'Asia/Jerusalem'\n * Location.legacyTzToTzid(0, 'eu'); // 'Europe/London'\n * Location.legacyTzToTzid(0, 'none'); // 'UTC'\n * Location.legacyTzToTzid(-5, 'none'); // 'Etc/GMT-5'\n * @param tz integer, GMT offset in hours\n * @param dst 'none', 'eu', 'usa', or 'israel'\n */\n static legacyTzToTzid(tz: number, dst: string): string | undefined {\n tz = +tz;\n if (dst === 'none') {\n if (tz === 0) {\n return 'UTC';\n }\n const plus = tz > 0 ? '+' : '';\n return `Etc/GMT${plus}${tz}`;\n }\n if (tz === 2 && dst === 'israel') {\n return 'Asia/Jerusalem';\n }\n if (dst === 'eu') {\n switch (tz) {\n case -2:\n return 'Atlantic/Cape_Verde';\n case -1:\n return 'Atlantic/Azores';\n case 0:\n return 'Europe/London';\n case 1:\n return 'Europe/Paris';\n case 2:\n return 'Europe/Athens';\n default:\n break;\n }\n }\n if (dst === 'usa') {\n return ZIPCODES_TZ_MAP[String(tz * -1)];\n }\n return undefined;\n }\n\n /**\n * Converts timezone info from Zip-Codes.com to a standard Olson tzid.\n * @example\n * Location.getUsaTzid('AZ', 7, 'Y') // 'America/Denver'\n * @param state two-letter all-caps US state abbreviation like 'CA'\n * @param tz positive number, 5=America/New_York, 8=America/Los_Angeles\n * @param dst single char 'Y' or 'N'\n */\n static getUsaTzid(state: string, tz: number, dst: string): string {\n tz = +tz;\n if (tz === 10 && state === 'AK') {\n return 'America/Adak';\n }\n if (tz === 7 && state === 'AZ') {\n return dst === 'Y' ? 'America/Denver' : 'America/Phoenix';\n }\n return ZIPCODES_TZ_MAP[tz];\n }\n\n /**\n * Registers a new named location with the built-in `Location.lookup()`\n * registry. Names are stored case-insensitively. Returns `false` if a\n * location with the same (lower-cased) name is already registered, and\n * `true` if successfully added.\n *\n * Use this to extend the built-in set of 65 classic Hebcal cities with\n * your own custom locations.\n * @example\n * const tlv = new Location(32.0853, 34.7818, true,\n * 'Asia/Jerusalem', 'My Office, Tel Aviv', 'IL');\n * Location.addLocation('My Office', tlv); // true\n * Location.lookup('my office')?.getTzid(); // 'Asia/Jerusalem'\n * @param cityName name to register the location under (case insensitive)\n * @param location the `Location` instance to register\n */\n static addLocation(cityName: string, location: Location): boolean {\n const name = cityName.toLowerCase();\n if (classicCities.has(name)) {\n return false;\n }\n classicCities.set(name, location);\n return true;\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAKH,MAAM,aAAa,GAAG,IAAI,GAAG,EAAoB;AAEjD;AACA,MAAM,eAAe,GAA2B;AAC9C,IAAA,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,qBAAqB;IAC1B,GAAG,EAAE,kBAAkB;IACvB,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,gBAAgB;IACrB,GAAG,EAAE,qBAAqB;IAC1B,GAAG,E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.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { months, HDate } from '@hebcal/hdate';
3
3
 
4
4
  const SUN = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"modern.js","sources":["../../../src/modern.ts"],"sourcesContent":["import {HDate, months} from '@hebcal/hdate';\n\nconst SUN = 0;\nconst TUE = 2;\nconst FRI = 5;\nconst SAT = 6;\n\nconst NISAN = months.NISAN;\nconst IYYAR = months.IYYAR;\n\n/**\n * Yom HaShoah first observed in 1951.\n * When the actual date of Yom Hashoah falls on a Friday, the\n * state of Israel observes Yom Hashoah on the preceding\n * Thursday. When it falls on a Sunday, Yom Hashoah is observed\n * on the following Monday.\n * http://www.ushmm.org/remembrance/dor/calendar/\n * @private\n * @param year\n */\nexport function dateYomHaShoah(year: number): HDate | null {\n if (year < 5711) {\n return null;\n }\n let nisan27dt = new HDate(27, NISAN, year);\n if (nisan27dt.getDay() === FRI) {\n nisan27dt = new HDate(26, NISAN, year);\n } else if (nisan27dt.getDay() === SUN) {\n nisan27dt = new HDate(28, NISAN, year);\n }\n return nisan27dt;\n}\n\n/**\n * Yom HaAtzma'ut only celebrated after 1948\n * @private\n * @param year\n */\nexport function dateYomHaZikaron(year: number): HDate | null {\n if (year < 5708) {\n return null;\n }\n let day;\n const pesach = new HDate(15, NISAN, year);\n const pdow = pesach.getDay();\n if (pdow === SUN) {\n day = 2;\n } else if (pdow === SAT) {\n day = 3;\n } else if (year < 5764) {\n day = 4;\n } else if (pdow === TUE) {\n day = 5;\n } else {\n day = 4;\n }\n return new HDate(day, IYYAR, year);\n}\n"],"names":[],"mappings":";;;AAEA,MAAM,GAAG,GAAG,CAAC;AACb,MAAM,GAAG,GAAG,CAAC;AACb,MAAM,GAAG,GAAG,CAAC;AACb,MAAM,GAAG,GAAG,CAAC;AAEb,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK;AAC1B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK;AAE1B;;;;;;;;;AASG;AACG,SAAU,cAAc,CAAC,IAAY,EAAA;AACzC,IAAA,IAAI,IAAI,GAAG,IAAI,EAAE;AACf,QAAA,OAAO,IAAI;IACb;IACA,IAAI,SAAS,GAAG,IAAI,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC;AAC1C,IAAA,IAAI,SAAS,CAAC,MAAM,EAAE,KAAK,GAAG,EAAE;QAC9B,SAAS,GAAG,IAAI,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC;IACxC;AAAO,SAAA,IAAI,SAAS,CAAC,MAAM,EAAE,KAAK,GAAG,EAAE;QACrC,SAAS,GAAG,IAAI,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC;IACxC;AACA,IAAA,OAAO,SAAS;AAClB;AAEA;;;;AAIG;AACG,SAAU,gBAAgB,CAAC,IAAY,EAAA;AAC3C,IAAA,IAAI,IAAI,GAAG,IAAI,EAAE;AACf,QAAA,OAAO,IAAI;IACb;AACA,IAAA,IAAI,GAAG;IACP,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC;AACzC,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE;AAC5B,IAAA,IAAI,IAAI,KAAK,GAAG,EAAE;QAChB,GAAG,GAAG,CAAC;IACT;AAAO,SAAA,IAAI,IAAI,KAAK,GAAG,EAAE;QACvB,GAAG,GAAG,CAAC;IACT;AAAO,SAAA,IAAI,IAAI,GAAG,IAAI,EAAE;QACtB,GAAG,GAAG,CAAC;IACT;AAAO,SAAA,IAAI,IAAI,KAAK,GAAG,EAAE;QACvB,GAAG,GAAG,CAAC;IACT;SAAO;QACL,GAAG,GAAG,CAAC;IACT;IACA,OAAO,IAAI,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC;AACpC;;;;"}
1
+ {"version":3,"file":"modern.js","sources":["../../../src/modern.ts"],"sourcesContent":["import {HDate, months} from '@hebcal/hdate';\n\nconst SUN = 0;\nconst TUE = 2;\nconst FRI = 5;\nconst SAT = 6;\n\nconst NISAN = months.NISAN;\nconst IYYAR = months.IYYAR;\n\n/**\n * Yom HaShoah first observed in 1951.\n * When the actual date of Yom Hashoah falls on a Friday, the\n * state of Israel observes Yom Hashoah on the preceding\n * Thursday. When it falls on a Sunday, Yom Hashoah is observed\n * on the following Monday.\n * http://www.ushmm.org/remembrance/dor/calendar/\n * @private\n * @param year\n */\nexport function dateYomHaShoah(year: number): HDate | null {\n if (year < 5711) {\n return null;\n }\n let nisan27dt = new HDate(27, NISAN, year);\n if (nisan27dt.getDay() === FRI) {\n nisan27dt = new HDate(26, NISAN, year);\n } else if (nisan27dt.getDay() === SUN) {\n nisan27dt = new HDate(28, NISAN, year);\n }\n return nisan27dt;\n}\n\n/**\n * Yom HaAtzma'ut only celebrated after 1948\n * @private\n * @param year\n */\nexport function dateYomHaZikaron(year: number): HDate | null {\n if (year < 5708) {\n return null;\n }\n let day;\n const pesach = new HDate(15, NISAN, year);\n const pdow = pesach.getDay();\n if (pdow === SUN) {\n day = 2;\n } else if (pdow === SAT) {\n day = 3;\n } else if (year < 5764) {\n day = 4;\n } else if (pdow === TUE) {\n day = 5;\n } else {\n day = 4;\n }\n return new HDate(day, IYYAR, year);\n}\n"],"names":[],"mappings":";;;AAEA,MAAM,GAAG,GAAG,CAAC;AACb,MAAM,GAAG,GAAG,CAAC;AACb,MAAM,GAAG,GAAG,CAAC;AACb,MAAM,GAAG,GAAG,CAAC;AAEb,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK;AAC1B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK;AAE1B;;;;;;;;;AASG;AACG,SAAU,cAAc,CAAC,IAAY,EAAA;AACzC,IAAA,IAAI,IAAI,GAAG,IAAI,EAAE;AACf,QAAA,OAAO,IAAI;IACb;IACA,IAAI,SAAS,GAAG,IAAI,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC;AAC1C,IAAA,IAAI,SAAS,CAAC,MAAM,EAAE,KAAK,GAAG,EAAE;QAC9B,SAAS,GAAG,IAAI,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC;IACxC;AAAO,SAAA,IAAI,SAAS,CAAC,MAAM,EAAE,KAAK,GAAG,EAAE;QACrC,SAAS,GAAG,IAAI,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC;IACxC;AACA,IAAA,OAAO,SAAS;AAClB;AAEA;;;;AAIG;AACG,SAAU,gBAAgB,CAAC,IAAY,EAAA;AAC3C,IAAA,IAAI,IAAI,GAAG,IAAI,EAAE;AACf,QAAA,OAAO,IAAI;IACb;AACA,IAAA,IAAI,GAAG;IACP,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC;AACzC,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE;AAC5B,IAAA,IAAI,IAAI,KAAK,GAAG,EAAE;QAChB,GAAG,GAAG,CAAC;IACT;AAAO,SAAA,IAAI,IAAI,KAAK,GAAG,EAAE;QACvB,GAAG,GAAG,CAAC;IACT;AAAO,SAAA,IAAI,IAAI,GAAG,IAAI,EAAE;QACtB,GAAG,GAAG,CAAC;IACT;AAAO,SAAA,IAAI,IAAI,KAAK,GAAG,EAAE;QACvB,GAAG,GAAG,CAAC;IACT;SAAO;QACL,GAAG,GAAG,CAAC;IACT;IACA,OAAO,IAAI,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC;AACpC;;"}
package/dist/esm/molad.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.9.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.10.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import 'temporal-polyfill/global';
3
3
  import { Event, flags } from './event.js';
4
4
  import { HDate, Locale, pad2 } from '@hebcal/hdate';
@@ -1 +1 @@
1
- {"version":3,"file":"molad.js","sources":["../../../src/molad.ts"],"sourcesContent":["import 'temporal-polyfill/global';\nimport {Event, flags} from './event.js';\nimport {CalOptions} from './CalOptions.js';\nimport {HDate, Locale, pad2} from '@hebcal/hdate';\nimport {reformatTimeStr} from './reformatTimeStr.js';\nimport {MoladBase, calculateMolad} from './moladBase.js';\nimport {getMoladAsDate} from './moladDate.js';\nimport {smartApostrophe} from './string.js';\nimport './locale.js'; // Adds Hebrew and Ashkenazic translations\n\nconst enDoW = [\n 'Sunday',\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday',\n 'Saturday',\n] as const;\n\nconst heDayNames = [\n 'רִאשׁוֹן',\n 'שֵׁנִי',\n 'שְׁלִישִׁי',\n 'רְבִיעִי',\n 'חֲמִישִׁי',\n 'שִׁישִּׁי',\n 'שַׁבָּת',\n] as const;\n\nconst frDoW = [\n 'Dimanche',\n 'Lundi',\n 'Mardi',\n 'Mercredi',\n 'Jeudi',\n 'Vendredi',\n 'Samedi',\n] as const;\nconst night = 'בַּלַּ֥יְלָה';\n\nfunction getDayNames(locale?: string): readonly string[] {\n if (Locale.isHebrewLocale(locale)) {\n return heDayNames;\n }\n if (locale === 'fr') {\n return frDoW;\n }\n return enDoW;\n}\n\nfunction getHebrewTimeOfDay(hour: number): string {\n if (hour < 5) return night;\n if (hour < 12) return 'בַּבֹּקֶר';\n if (hour < 17) return 'בַּצׇּהֳרַיִים';\n if (hour < 21) return 'בָּעֶרֶב';\n return night;\n}\n\n/**\n * Represents a *molad* — the calculated moment when the new moon is \"born\"\n * for a given Hebrew month.\n *\n * The molad is announced in synagogue on Shabbat Mevarchim (the Shabbat\n * before Rosh Chodesh) and is the anchor point for Kiddush Levana zmanim.\n * Calculations use the traditional chalakim arithmetic\n * (1 hour = 1080 chalakim) anchored to *Molad Tohu BaHaRaD*.\n *\n * @example\n * import {Molad, months} from '@hebcal/core';\n * const m = new Molad(5784, months.NISAN);\n * console.log(m.getMonthName()); // 'Nisan'\n * console.log(m.getHour(), m.getMinutes(), m.getChalakim()); // 22 57 7\n * console.log(m.render('en')); // 'Molad Nisan: Monday, 10:57pm and 7 chalakim'\n */\nexport class Molad {\n private readonly m: MoladBase;\n private readonly year: number;\n private readonly month: number;\n private instant?: Temporal.ZonedDateTime;\n\n /**\n * Calculates the molad for a given Hebrew year and month.\n * @param year Hebrew year\n * @param month 1=NISAN, 7=TISHREI (uses Nisan-based numbering)\n */\n constructor(year: number, month: number) {\n this.m = calculateMolad(year, month);\n this.year = year;\n this.month = month;\n }\n /**\n * The exact Hebrew date of the molad, which often falls on the\n * 28th or 30th of the preceeding month, occasionally on the first of the\n * month, and in extremely rare circumstances the 27th of the month.\n * - Molad Shevat 5541 occured on 27 Tevet / 1781-01-24T19:57:20.170Z\n * - Molad Shevat 5788 will occur on 27 Tevet / 2028-01-26T19:07:03.504Z\n * - Molad Nissan 5866 will occur on 27 Adar II / 2106-04-03T21:08:46.837Z\n */\n getMoladDate(): HDate {\n return this.m.hdate;\n }\n /**\n * The year of the molad (as constructed)\n */\n getYear(): number {\n return this.year;\n }\n /**\n * The month (1=NISSAN, 7=TISHREI) as constructed\n */\n getMonth(): number {\n return this.month;\n }\n /**\n * Returns a transliterated string name of the molad's Hebrew month,\n * for example 'Elul' or 'Cheshvan'.\n */\n getMonthName(): string {\n return HDate.getMonthName(this.month, this.year);\n }\n /**\n * @returns Day of Week (0=Sunday, 6=Saturday)\n */\n getDow(): number {\n return this.m.hdate.getDay();\n }\n /**\n * @returns hour of day (0-23)\n */\n getHour(): number {\n return this.m.hour;\n }\n /**\n * @returns minutes past hour (0-59)\n */\n getMinutes(): number {\n return this.m.minutes;\n }\n /**\n * @returns parts of a minute (0-17)\n */\n getChalakim(): number {\n return this.m.chalakim;\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 * The returned value is cached after the first call.\n * @example\n * import {Molad, months} from '@hebcal/core';\n * const m = new Molad(5784, months.NISAN);\n * const zdt = m.getInstant();\n * console.log(zdt.toString()); // '2024-04-08T20:36:26.837+00:00[UTC]'\n * @return the `Temporal.ZonedDateTime` representing the moment of the molad\n */\n getInstant(): Temporal.ZonedDateTime {\n this.instant ??= getMoladAsDate(this.m);\n return this.instant;\n }\n /**\n * Returns the earliest time of _Kiddush Levana_ calculated as 3 days after the molad. This method returns the time\n * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider\n * displaying the next _tzais_ if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment 3 days after the molad.\n */\n getTchilasZmanKidushLevana3Days(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n return zdt.add({hours: 72});\n }\n\n /**\n * Returns the earliest time of Kiddush Levana calculated as 7 days after the molad as mentioned by the\n * [Mechaber](https://en.wikipedia.org/wiki/Yosef_Karo). See the\n * [Bach's](https://en.wikipedia.org/wiki/Yoel_Sirkis) opinion on this time. This method returns the time\n * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider\n * displaying the next _tzais_ if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment 7 days after the molad.\n */\n getTchilasZmanKidushLevana7Days(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n return zdt.add({hours: 168});\n }\n\n /**\n * Returns the latest time of Kiddush Levana according to the\n * [Maharil's](https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin) opinion that it is calculated as\n * halfway between molad and molad. This adds half the 29 days, 12 hours and 793 chalakim time between molad and\n * molad (14 days, 18 hours, 22 minutes and 666 milliseconds) to the month's molad. This method returns the time\n * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider\n * displaying _alos_ before this time if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment halfway between molad and molad.\n */\n getSofZmanKidushLevanaBetweenMoldos(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n // add half the time between molad and molad (half of 29 days, 12 hours and 793 chalakim (44 minutes, 3.3\n // seconds), or 14 days, 18 hours, 22 minutes and 666 milliseconds). Add it as hours, not days, to avoid\n // DST/ST crossover issues.\n return zdt.add({\n hours: 24 * 14 + 18,\n minutes: 22,\n seconds: 1,\n milliseconds: 666,\n });\n }\n\n /**\n * Returns the latest time of Kiddush Levana calculated as 15 days after the molad. This is the opinion brought down\n * in the Shulchan Aruch (Orach Chaim 426). It should be noted that some opinions hold that the\n * [Rema](https://en.wikipedia.org/wiki/Moses_Isserles) who brings down the opinion of the\n * [Maharil's](https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin) of calculating\n * {@link Molad.getSofZmanKidushLevanaBetweenMoldos | half way between molad and molad} is of the opinion that Mechaber\n * agrees to his opinion. Also see the Aruch Hashulchan. For additional details on the subject, See Rabbi Dovid\n * Heber's very detailed writeup in Siman Daled (chapter 4) of\n * [Shaarei Zmanim](https://www.worldcat.org/oclc/461326125). This method returns the time even if it is during\n * the day when _Kiddush Levana_ can't be said. Callers of this method should consider displaying _alos_\n * before this time if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment 15 days after the molad.\n */\n getSofZmanKidushLevana15Days(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n // 15 days after the molad. Add it as hours, not days, to avoid DST/ST crossover issues.\n return zdt.add({hours: 24 * 15});\n }\n\n /**\n * Returns a human-readable, localized string announcing the molad —\n * suitable for use on Shabbat Mevarchim. The format includes the Hebrew\n * month name, day of week, hour : minute, and chalakim if non-zero.\n *\n * Time format honors `options.hour12` and `options.location` (12-hour vs.\n * 24-hour); see {@link reformatTimeStr}.\n * @example\n * import {Molad, months} from '@hebcal/core';\n * const m = new Molad(5784, months.NISAN);\n * m.render('en', {hour12: true});\n * // => 'Molad Nisan: Monday, 10:57pm and 7 chalakim'\n * m.render('en', {hour12: false});\n * // => 'Molad Nisan: Monday, 22:57 and 7 chalakim'\n * m.render('he');\n * // => 'מוֹלָד הָלְּבָנָה נִיסָן יִהְיֶה בַּיּוֹם שֵׁנִי בשָׁבוּעַ, …'\n * @param [locale] Optional locale name (defaults to empty locale)\n * @param options used for time formatting (12-hour vs 24-hour)\n */\n render(locale?: string, options?: CalOptions): string {\n const monthName = Locale.gettext(this.getMonthName(), locale);\n const dayNames = getDayNames(locale);\n const dow = dayNames[this.getDow()];\n const minutes = this.getMinutes();\n const hour = this.getHour();\n const chalakim = this.getChalakim();\n const moladStr = Locale.gettext('Molad', locale);\n const minutesStr = Locale.lookupTranslation('min', locale) ?? 'minutes';\n const chalakimStr = Locale.gettext('chalakim', locale);\n const and = Locale.gettext('and', locale);\n if (Locale.isHebrewLocale(locale)) {\n const ampm = getHebrewTimeOfDay(hour);\n let result =\n `${moladStr} ${monthName} יִהְיֶה בַּיּוֹם ${dow} בשָׁבוּעַ, ` +\n `בְּשָׁעָה ${hour} ${ampm}, ` +\n `ו-${minutes} ${minutesStr}`;\n if (chalakim !== 0) {\n result += ` ו-${chalakim} ${chalakimStr}`;\n }\n if (locale!.toLocaleLowerCase() === 'he-x-nonikud') {\n return Locale.hebrewStripNikkud(result);\n }\n return result;\n }\n const fmtTime = reformatTimeStr(`${hour}:${pad2(minutes)}`, 'pm', options);\n const month = smartApostrophe(monthName);\n const result = `${moladStr} ${month}: ${dow}, ${fmtTime}`;\n if (chalakim === 0) {\n return result;\n }\n return result + ` ${and} ${chalakim} ${chalakimStr}`;\n }\n}\n\n/** Represents a Molad announcement on Shabbat Mevarchim */\nexport class MoladEvent extends Event {\n readonly molad: Molad;\n private readonly options: CalOptions;\n /**\n * @param date Hebrew date event occurs\n * @param hyear molad year\n * @param hmonth molad month\n * @param options\n */\n constructor(date: HDate, hyear: number, hmonth: number, options: CalOptions) {\n const m = new Molad(hyear, hmonth);\n const monthName = m.getMonthName();\n super(date, `Molad ${monthName} ${hyear}`, flags.MOLAD);\n this.molad = m;\n this.options = options;\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n render(locale?: string): string {\n return this.molad.render(locale, this.options);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AAUA,MAAM,KAAK,GAAG;IACZ,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,WAAW;IACX,UAAU;IACV,QAAQ;IACR,UAAU;CACF;AAEV,MAAM,UAAU,GAAG;IACjB,UAAU;IACV,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,WAAW;IACX,WAAW;IACX,SAAS;CACD;AAEV,MAAM,KAAK,GAAG;IACZ,UAAU;IACV,OAAO;IACP,OAAO;IACP,UAAU;IACV,OAAO;IACP,UAAU;IACV,QAAQ;CACA;AACV,MAAM,KAAK,GAAG,cAAc;AAE5B,SAAS,WAAW,CAAC,MAAe,EAAA;AAClC,IAAA,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE;AACjC,QAAA,OAAO,UAAU;IACnB;AACA,IAAA,IAAI,MAAM,KAAK,IAAI,EAAE;AACnB,QAAA,OAAO,KAAK;IACd;AACA,IAAA,OAAO,KAAK;AACd;AAEA,SAAS,kBAAkB,CAAC,IAAY,EAAA;IACtC,IAAI,IAAI,GAAG,CAAC;AAAE,QAAA,OAAO,KAAK;IAC1B,IAAI,IAAI,GAAG,EAAE;AAAE,QAAA,OAAO,WAAW;IACjC,IAAI,IAAI,GAAG,EAAE;AAAE,QAAA,OAAO,gBAAgB;IACtC,IAAI,IAAI,GAAG,EAAE;AAAE,QAAA,OAAO,UAAU;AAChC,IAAA,OAAO,KAAK;AACd;AAEA;;;;;;;;;;;;;;;AAeG;MACU,KAAK,CAAA;AACC,IAAA,CAAC;AACD,IAAA,IAAI;A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AQ,KAAK,CAAC,EAAE;AAClB,YAAA,OAAO,MAAM;QACf;QACA,OAAO,MAAM,GAAG,CAAA,CAAA,EAAI,GAAG,IAAI,QAAQ,CAAA,CAAA,EAAI,WAAW,CAAA,CAAE;IACtD;AACD;AAED;AACM,MAAO,UAAW,SAAQ,KAAK,CAAA;AAC1B,IAAA,KAAK;AACG,IAAA,OAAO;AACxB;;;;;AAKG;AACH,IAAA,WAAA,CAAY,IAAW,EAAE,KAAa,EAAE,MAAc,EAAE,OAAmB,EAAA;QACzE,MAAM,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC;AAClC,QAAA,MAAM,SAAS,GAAG,CAAC,CAAC,YAAY,EAAE;AAClC,QAAA,KAAK,CAAC,IAAI,EAAE,CAAA,MAAA,EAAS,SAAS,CAAA,CAAA,EAAI,KAAK,CAAA,CAAE,EAAE,KAAK,CAAC,KAAK,CAAC;AACvD,QAAA,IAAI,CAAC,KAAK,GAAG,CAAC;AACd,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO;IACxB;AACA;;AAEG;AACH,IAAA,MAAM,CAAC,MAAe,EAAA;AACpB,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC;IAChD;AACD;;;;"}
1
+ {"version":3,"file":"molad.js","sources":["../../../src/molad.ts"],"sourcesContent":["import 'temporal-polyfill/global';\nimport {Event, flags} from './event.js';\nimport {CalOptions} from './CalOptions.js';\nimport {HDate, Locale, pad2} from '@hebcal/hdate';\nimport {reformatTimeStr} from './reformatTimeStr.js';\nimport {MoladBase, calculateMolad} from './moladBase.js';\nimport {getMoladAsDate} from './moladDate.js';\nimport {smartApostrophe} from './string.js';\nimport './locale.js'; // Adds Hebrew and Ashkenazic translations\n\nconst enDoW = [\n 'Sunday',\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday',\n 'Saturday',\n] as const;\n\nconst heDayNames = [\n 'רִאשׁוֹן',\n 'שֵׁנִי',\n 'שְׁלִישִׁי',\n 'רְבִיעִי',\n 'חֲמִישִׁי',\n 'שִׁישִּׁי',\n 'שַׁבָּת',\n] as const;\n\nconst frDoW = [\n 'Dimanche',\n 'Lundi',\n 'Mardi',\n 'Mercredi',\n 'Jeudi',\n 'Vendredi',\n 'Samedi',\n] as const;\nconst night = 'בַּלַּ֥יְלָה';\n\nfunction getDayNames(locale?: string): readonly string[] {\n if (Locale.isHebrewLocale(locale)) {\n return heDayNames;\n }\n if (locale === 'fr') {\n return frDoW;\n }\n return enDoW;\n}\n\nfunction getHebrewTimeOfDay(hour: number): string {\n if (hour < 5) return night;\n if (hour < 12) return 'בַּבֹּקֶר';\n if (hour < 17) return 'בַּצׇּהֳרַיִים';\n if (hour < 21) return 'בָּעֶרֶב';\n return night;\n}\n\n/**\n * Represents a *molad* — the calculated moment when the new moon is \"born\"\n * for a given Hebrew month.\n *\n * The molad is announced in synagogue on Shabbat Mevarchim (the Shabbat\n * before Rosh Chodesh) and is the anchor point for Kiddush Levana zmanim.\n * Calculations use the traditional chalakim arithmetic\n * (1 hour = 1080 chalakim) anchored to *Molad Tohu BaHaRaD*.\n *\n * @example\n * import {Molad, months} from '@hebcal/core';\n * const m = new Molad(5784, months.NISAN);\n * console.log(m.getMonthName()); // 'Nisan'\n * console.log(m.getHour(), m.getMinutes(), m.getChalakim()); // 22 57 7\n * console.log(m.render('en')); // 'Molad Nisan: Monday, 10:57pm and 7 chalakim'\n */\nexport class Molad {\n private readonly m: MoladBase;\n private readonly year: number;\n private readonly month: number;\n private instant?: Temporal.ZonedDateTime;\n\n /**\n * Calculates the molad for a given Hebrew year and month.\n * @param year Hebrew year\n * @param month 1=NISAN, 7=TISHREI (uses Nisan-based numbering)\n */\n constructor(year: number, month: number) {\n this.m = calculateMolad(year, month);\n this.year = year;\n this.month = month;\n }\n /**\n * The exact Hebrew date of the molad, which often falls on the\n * 28th or 30th of the preceeding month, occasionally on the first of the\n * month, and in extremely rare circumstances the 27th of the month.\n * - Molad Shevat 5541 occured on 27 Tevet / 1781-01-24T19:57:20.170Z\n * - Molad Shevat 5788 will occur on 27 Tevet / 2028-01-26T19:07:03.504Z\n * - Molad Nissan 5866 will occur on 27 Adar II / 2106-04-03T21:08:46.837Z\n */\n getMoladDate(): HDate {\n return this.m.hdate;\n }\n /**\n * The year of the molad (as constructed)\n */\n getYear(): number {\n return this.year;\n }\n /**\n * The month (1=NISSAN, 7=TISHREI) as constructed\n */\n getMonth(): number {\n return this.month;\n }\n /**\n * Returns a transliterated string name of the molad's Hebrew month,\n * for example 'Elul' or 'Cheshvan'.\n */\n getMonthName(): string {\n return HDate.getMonthName(this.month, this.year);\n }\n /**\n * @returns Day of Week (0=Sunday, 6=Saturday)\n */\n getDow(): number {\n return this.m.hdate.getDay();\n }\n /**\n * @returns hour of day (0-23)\n */\n getHour(): number {\n return this.m.hour;\n }\n /**\n * @returns minutes past hour (0-59)\n */\n getMinutes(): number {\n return this.m.minutes;\n }\n /**\n * @returns parts of a minute (0-17)\n */\n getChalakim(): number {\n return this.m.chalakim;\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 * The returned value is cached after the first call.\n * @example\n * import {Molad, months} from '@hebcal/core';\n * const m = new Molad(5784, months.NISAN);\n * const zdt = m.getInstant();\n * console.log(zdt.toString()); // '2024-04-08T20:36:26.837+00:00[UTC]'\n * @return the `Temporal.ZonedDateTime` representing the moment of the molad\n */\n getInstant(): Temporal.ZonedDateTime {\n this.instant ??= getMoladAsDate(this.m);\n return this.instant;\n }\n /**\n * Returns the earliest time of _Kiddush Levana_ calculated as 3 days after the molad. This method returns the time\n * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider\n * displaying the next _tzais_ if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment 3 days after the molad.\n */\n getTchilasZmanKidushLevana3Days(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n return zdt.add({hours: 72});\n }\n\n /**\n * Returns the earliest time of Kiddush Levana calculated as 7 days after the molad as mentioned by the\n * [Mechaber](https://en.wikipedia.org/wiki/Yosef_Karo). See the\n * [Bach's](https://en.wikipedia.org/wiki/Yoel_Sirkis) opinion on this time. This method returns the time\n * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider\n * displaying the next _tzais_ if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment 7 days after the molad.\n */\n getTchilasZmanKidushLevana7Days(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n return zdt.add({hours: 168});\n }\n\n /**\n * Returns the latest time of Kiddush Levana according to the\n * [Maharil's](https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin) opinion that it is calculated as\n * halfway between molad and molad. This adds half the 29 days, 12 hours and 793 chalakim time between molad and\n * molad (14 days, 18 hours, 22 minutes and 666 milliseconds) to the month's molad. This method returns the time\n * even if it is during the day when _Kiddush Levana_ can't be said. Callers of this method should consider\n * displaying _alos_ before this time if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment halfway between molad and molad.\n */\n getSofZmanKidushLevanaBetweenMoldos(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n // add half the time between molad and molad (half of 29 days, 12 hours and 793 chalakim (44 minutes, 3.3\n // seconds), or 14 days, 18 hours, 22 minutes and 666 milliseconds). Add it as hours, not days, to avoid\n // DST/ST crossover issues.\n return zdt.add({\n hours: 24 * 14 + 18,\n minutes: 22,\n seconds: 1,\n milliseconds: 666,\n });\n }\n\n /**\n * Returns the latest time of Kiddush Levana calculated as 15 days after the molad. This is the opinion brought down\n * in the Shulchan Aruch (Orach Chaim 426). It should be noted that some opinions hold that the\n * [Rema](https://en.wikipedia.org/wiki/Moses_Isserles) who brings down the opinion of the\n * [Maharil's](https://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin) of calculating\n * {@link Molad.getSofZmanKidushLevanaBetweenMoldos | half way between molad and molad} is of the opinion that Mechaber\n * agrees to his opinion. Also see the Aruch Hashulchan. For additional details on the subject, See Rabbi Dovid\n * Heber's very detailed writeup in Siman Daled (chapter 4) of\n * [Shaarei Zmanim](https://www.worldcat.org/oclc/461326125). This method returns the time even if it is during\n * the day when _Kiddush Levana_ can't be said. Callers of this method should consider displaying _alos_\n * before this time if the zman is between _alos_ and _tzais_.\n *\n * @return the Temporal.ZonedDateTime representing the moment 15 days after the molad.\n */\n getSofZmanKidushLevana15Days(): Temporal.ZonedDateTime {\n const zdt = this.getInstant();\n // 15 days after the molad. Add it as hours, not days, to avoid DST/ST crossover issues.\n return zdt.add({hours: 24 * 15});\n }\n\n /**\n * Returns a human-readable, localized string announcing the molad —\n * suitable for use on Shabbat Mevarchim. The format includes the Hebrew\n * month name, day of week, hour : minute, and chalakim if non-zero.\n *\n * Time format honors `options.hour12` and `options.location` (12-hour vs.\n * 24-hour); see {@link reformatTimeStr}.\n * @example\n * import {Molad, months} from '@hebcal/core';\n * const m = new Molad(5784, months.NISAN);\n * m.render('en', {hour12: true});\n * // => 'Molad Nisan: Monday, 10:57pm and 7 chalakim'\n * m.render('en', {hour12: false});\n * // => 'Molad Nisan: Monday, 22:57 and 7 chalakim'\n * m.render('he');\n * // => 'מוֹלָד הָלְּבָנָה נִיסָן יִהְיֶה בַּיּוֹם שֵׁנִי בשָׁבוּעַ, …'\n * @param [locale] Optional locale name (defaults to empty locale)\n * @param options used for time formatting (12-hour vs 24-hour)\n */\n render(locale?: string, options?: CalOptions): string {\n const monthName = Locale.gettext(this.getMonthName(), locale);\n const dayNames = getDayNames(locale);\n const dow = dayNames[this.getDow()];\n const minutes = this.getMinutes();\n const hour = this.getHour();\n const chalakim = this.getChalakim();\n const moladStr = Locale.gettext('Molad', locale);\n const minutesStr = Locale.lookupTranslation('min', locale) ?? 'minutes';\n const chalakimStr = Locale.gettext('chalakim', locale);\n const and = Locale.gettext('and', locale);\n if (Locale.isHebrewLocale(locale)) {\n const ampm = getHebrewTimeOfDay(hour);\n let result =\n `${moladStr} ${monthName} יִהְיֶה בַּיּוֹם ${dow} בשָׁבוּעַ, ` +\n `בְּשָׁעָה ${hour} ${ampm}, ` +\n `ו-${minutes} ${minutesStr}`;\n if (chalakim !== 0) {\n result += ` ו-${chalakim} ${chalakimStr}`;\n }\n if (locale!.toLocaleLowerCase() === 'he-x-nonikud') {\n return Locale.hebrewStripNikkud(result);\n }\n return result;\n }\n const fmtTime = reformatTimeStr(`${hour}:${pad2(minutes)}`, 'pm', options);\n const month = smartApostrophe(monthName);\n const result = `${moladStr} ${month}: ${dow}, ${fmtTime}`;\n if (chalakim === 0) {\n return result;\n }\n return result + ` ${and} ${chalakim} ${chalakimStr}`;\n }\n}\n\n/** Represents a Molad announcement on Shabbat Mevarchim */\nexport class MoladEvent extends Event {\n readonly molad: Molad;\n private readonly options: CalOptions;\n /**\n * @param date Hebrew date event occurs\n * @param hyear molad year\n * @param hmonth molad month\n * @param options\n */\n constructor(date: HDate, hyear: number, hmonth: number, options: CalOptions) {\n const m = new Molad(hyear, hmonth);\n const monthName = m.getMonthName();\n super(date, `Molad ${monthName} ${hyear}`, flags.MOLAD);\n this.molad = m;\n this.options = options;\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n render(locale?: string): string {\n return this.molad.render(locale, this.options);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AAUA,MAAM,KAAK,GAAG;IACZ,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,WAAW;IACX,UAAU;IACV,QAAQ;IACR,UAAU;CACF;AAEV,MAAM,UAAU,GAAG;I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,CAAC,CAAC,YAAY,EAAE;AAClC,QAAA,KAAK,CAAC,IAAI,EAAE,CAAA,MAAA,EAAS,SAAS,CAAA,CAAA,EAAI,KAAK,CAAA,CAAE,EAAE,KAAK,CAAC,KAAK,CAAC;AACvD,QAAA,IAAI,CAAC,KAAK,GAAG,CAAC;AACd,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO;IACxB;AACA;;AAEG;AACH,IAAA,MAAM,CAAC,MAAe,EAAA;AACpB,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC;IAChD;AACD;;"}
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.9.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.10.0, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { HDate, isLeapYear } from '@hebcal/hdate';
3
3
 
4
4
  /*
@@ -1 +1 @@
1
- {"version":3,"file":"moladBase.js","sources":["../../../src/moladBase.ts"],"sourcesContent":["import {HDate, isLeapYear} from '@hebcal/hdate';\n\n/**\n * Represents a molad, the moment when the new moon is \"born\"\n */\nexport type MoladBase = {\n /** Hebrew date */\n readonly hdate: HDate;\n /** hour of day (0-23) */\n readonly hour: number;\n /** minutes past hour (0-59) */\n readonly minutes: number;\n /** parts of a minute (0-17) */\n readonly chalakim: number;\n};\n\n/*\n * Includes code ported from KosherJava, copyright 2004 Eliyahu Hershfeld,\n * released under LGPL 2.1.\n */\n\n/**\n * the Jewish epoch using the RD (Rata Die/Fixed Date or Reingold Dershowitz) day used in Calendrical Calculations.\n * Day 1 is January 1, 0001 of the Gregorian calendar\n */\nconst JEWISH_EPOCH: number = -1373429;\n\n/** The number of _chalakim_ (18) in a minute. */\nconst CHALAKIM_PER_MINUTE: number = 18;\n\n/** The number of _chalakim_ (1080) in an hour. */\nconst CHALAKIM_PER_HOUR: number = 1080;\n\n/** The number of _chalakim_ (25,920) in a 24-hour day. */\nconst CHALAKIM_PER_DAY: number = 25920; // 24 * 1080\n\n/** The number of _chalakim_ in an average Jewish month. A month has 29 days, 12 hours and 793\n * _chalakim_ (44 minutes and 3.3 seconds) for a total of 765,433 _chalakim_ */\nconst CHALAKIM_PER_MONTH: number = 765433; // (29 * 24 + 12) * 1080 + 793\n\n/**\n * Days from the beginning of Sunday till _molad BaHaRaD_. Calculated as 1 day, 5 hours and 204 _chalakim_ =\n * (24 + 5) * 1080 + 204 = 31524\n */\nconst CHALAKIM_MOLAD_TOHU: number = 31524;\n\n/**\n * Converts the NISSAN-based constants used by this class to numeric month starting from\n * TISHREI. This is required for _molad_ calculations.\n */\nfunction getJewishMonthOfYear(year: number, month: number): number {\n const leap: boolean = isLeapYear(year);\n return ((month + (leap ? 6 : 5)) % (leap ? 13 : 12)) + 1;\n}\n\n/**\n * Returns the number of _chalakim_ (parts - 1080 to the hour) from\n * the original hypothetical _Molad Tohu_ to the year and month\n * passed in.\n */\nfunction getChalakimSinceMoladTohu(year: number, month: number): number {\n // Jewish lunar month = 29 days, 12 hours and 793 chalakim\n // chalakim since Molad Tohu BeHaRaD - 1 day, 5 hours and 204 chalakim\n const monthOfYear: number = getJewishMonthOfYear(year, month);\n const monthsElapsed: number =\n 235 * Math.trunc((year - 1) / 19) + // Months in complete 19-year lunar (Metonic) cycles so far\n 12 * ((year - 1) % 19) + // Regular months in this cycle\n Math.trunc((7 * ((year - 1) % 19) + 1) / 19) + // Leap months this cycle\n (monthOfYear - 1); // add elapsed months till the start of the molad of the month\n // return chalakim prior to BeHaRaD + number of chalakim since\n return CHALAKIM_MOLAD_TOHU + CHALAKIM_PER_MONTH * monthsElapsed;\n}\n\n/**\n * Returns the number of days from the Jewish epoch from the number of chalakim from the epoch passed in.\n * @param chalakim the number of _chalakim_ since the beginning of Sunday prior to BaHaRaD\n * @return the number of days from the Jewish epoch\n */\nfunction moladToAbsDate(chalakim: number): number {\n return Math.trunc(chalakim / CHALAKIM_PER_DAY) + JEWISH_EPOCH;\n}\n\n/**\n * Calculates the molad (birth of the new moon) for a Hebrew month using\n * traditional chalakim arithmetic.\n *\n * Returns the raw components — day of week, hour, minutes and chalakim. Use\n * {@link Molad} for a higher-level interface with rendering and Kiddush Levana\n * times.\n * @param year Hebrew year\n * @param month Hebrew month (see `months` from `@hebcal/hdate`)\n * @return the components of the molad for that month\n */\nexport function calculateMolad(year: number, month: number): MoladBase {\n const chalakim = getChalakimSinceMoladTohu(year, month);\n const absDate = moladToAbsDate(chalakim);\n let hd = new HDate(absDate);\n const conjunctionDay: number = Math.trunc(chalakim / CHALAKIM_PER_DAY);\n const conjunctionParts: number = Math.trunc(\n chalakim - conjunctionDay * CHALAKIM_PER_DAY\n );\n\n let adjustedChalakim: number = conjunctionParts;\n let hour = Math.trunc(adjustedChalakim / CHALAKIM_PER_HOUR);\n adjustedChalakim = adjustedChalakim - hour * CHALAKIM_PER_HOUR;\n const minutes = Math.trunc(adjustedChalakim / CHALAKIM_PER_MINUTE);\n\n if (hour >= 6) {\n hd = hd.next();\n }\n hour = (hour + 18) % 24;\n\n const m: MoladBase = {\n hdate: hd,\n hour,\n minutes,\n chalakim: adjustedChalakim - minutes * CHALAKIM_PER_MINUTE,\n };\n\n return m;\n}\n"],"names":[],"mappings":";;;AAgBA;;;AAGG;AAEH;;;AAGG;AACH,MAAM,YAAY,GAAW,QAAQ;AAErC;AACA,MAAM,mBAAmB,GAAW,EAAE;AAEtC;AACA,MAAM,iBAAiB,GAAW,IAAI;AAEtC;AACA,MAAM,gBAAgB,GAAW,KAAK,CAAC;AAEvC;AAC+E;AAC/E,MAAM,kBAAkB,GAAW,MAAM,CAAC;AAE1C;;;AAGG;AACH,MAAM,mBAAmB,GAAW,KAAK;AAEzC;;;AAGG;AACH,SAAS,oBAAoB,CAAC,IAAY,EAAE,KAAa,EAAA;AACvD,IAAA,MAAM,IAAI,GAAY,UAAU,CAAC,IAAI,CAAC;AACtC,IAAA,OAAO,CAAC,CAAC,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C,IAAI,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,GAAG,iBAAiB,CAAC;AAC3D,IAAA,gBAAgB,GAAG,gBAAgB,GAAG,IAAI,GAAG,iBAAiB;IAC9D,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,GAAG,mBAAmB,CAAC;AAElE,IAAA,IAAI,IAAI,IAAI,CAAC,EAAE;AACb,QAAA,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE;IAChB;IACA,IAAI,GAAG,CAAC,IAAI,GAAG,EAAE,IAAI,EAAE;AAEvB,IAAA,MAAM,CAAC,GAAc;AACnB,QAAA,KAAK,EAAE,EAAE;QACT,IAAI;QACJ,OAAO;AACP,QAAA,QAAQ,EAAE,gBAAgB,GAAG,OAAO,GAAG,mBAAmB;KAC3D;AAED,IAAA,OAAO,CAAC;AACV;;;;"}
1
+ {"version":3,"file":"moladBase.js","sources":["../../../src/moladBase.ts"],"sourcesContent":["import {HDate, isLeapYear} from '@hebcal/hdate';\n\n/**\n * Represents a molad, the moment when the new moon is \"born\"\n */\nexport type MoladBase = {\n /** Hebrew date */\n readonly hdate: HDate;\n /** hour of day (0-23) */\n readonly hour: number;\n /** minutes past hour (0-59) */\n readonly minutes: number;\n /** parts of a minute (0-17) */\n readonly chalakim: number;\n};\n\n/*\n * Includes code ported from KosherJava, copyright 2004 Eliyahu Hershfeld,\n * released under LGPL 2.1.\n */\n\n/**\n * the Jewish epoch using the RD (Rata Die/Fixed Date or Reingold Dershowitz) day used in Calendrical Calculations.\n * Day 1 is January 1, 0001 of the Gregorian calendar\n */\nconst JEWISH_EPOCH: number = -1373429;\n\n/** The number of _chalakim_ (18) in a minute. */\nconst CHALAKIM_PER_MINUTE: number = 18;\n\n/** The number of _chalakim_ (1080) in an hour. */\nconst CHALAKIM_PER_HOUR: number = 1080;\n\n/** The number of _chalakim_ (25,920) in a 24-hour day. */\nconst CHALAKIM_PER_DAY: number = 25920; // 24 * 1080\n\n/** The number of _chalakim_ in an average Jewish month. A month has 29 days, 12 hours and 793\n * _chalakim_ (44 minutes and 3.3 seconds) for a total of 765,433 _chalakim_ */\nconst CHALAKIM_PER_MONTH: number = 765433; // (29 * 24 + 12) * 1080 + 793\n\n/**\n * Days from the beginning of Sunday till _molad BaHaRaD_. Calculated as 1 day, 5 hours and 204 _chalakim_ =\n * (24 + 5) * 1080 + 204 = 31524\n */\nconst CHALAKIM_MOLAD_TOHU: number = 31524;\n\n/**\n * Converts the NISSAN-based constants used by this class to numeric month starting from\n * TISHREI. This is required for _molad_ calculations.\n */\nfunction getJewishMonthOfYear(year: number, month: number): number {\n const leap: boolean = isLeapYear(year);\n return ((month + (leap ? 6 : 5)) % (leap ? 13 : 12)) + 1;\n}\n\n/**\n * Returns the number of _chalakim_ (parts - 1080 to the hour) from\n * the original hypothetical _Molad Tohu_ to the year and month\n * passed in.\n */\nfunction getChalakimSinceMoladTohu(year: number, month: number): number {\n // Jewish lunar month = 29 days, 12 hours and 793 chalakim\n // chalakim since Molad Tohu BeHaRaD - 1 day, 5 hours and 204 chalakim\n const monthOfYear: number = getJewishMonthOfYear(year, month);\n const monthsElapsed: number =\n 235 * Math.trunc((year - 1) / 19) + // Months in complete 19-year lunar (Metonic) cycles so far\n 12 * ((year - 1) % 19) + // Regular months in this cycle\n Math.trunc((7 * ((year - 1) % 19) + 1) / 19) + // Leap months this cycle\n (monthOfYear - 1); // add elapsed months till the start of the molad of the month\n // return chalakim prior to BeHaRaD + number of chalakim since\n return CHALAKIM_MOLAD_TOHU + CHALAKIM_PER_MONTH * monthsElapsed;\n}\n\n/**\n * Returns the number of days from the Jewish epoch from the number of chalakim from the epoch passed in.\n * @param chalakim the number of _chalakim_ since the beginning of Sunday prior to BaHaRaD\n * @return the number of days from the Jewish epoch\n */\nfunction moladToAbsDate(chalakim: number): number {\n return Math.trunc(chalakim / CHALAKIM_PER_DAY) + JEWISH_EPOCH;\n}\n\n/**\n * Calculates the molad (birth of the new moon) for a Hebrew month using\n * traditional chalakim arithmetic.\n *\n * Returns the raw components — day of week, hour, minutes and chalakim. Use\n * {@link Molad} for a higher-level interface with rendering and Kiddush Levana\n * times.\n * @param year Hebrew year\n * @param month Hebrew month (see `months` from `@hebcal/hdate`)\n * @return the components of the molad for that month\n */\nexport function calculateMolad(year: number, month: number): MoladBase {\n const chalakim = getChalakimSinceMoladTohu(year, month);\n const absDate = moladToAbsDate(chalakim);\n let hd = new HDate(absDate);\n const conjunctionDay: number = Math.trunc(chalakim / CHALAKIM_PER_DAY);\n const conjunctionParts: number = Math.trunc(\n chalakim - conjunctionDay * CHALAKIM_PER_DAY\n );\n\n let adjustedChalakim: number = conjunctionParts;\n let hour = Math.trunc(adjustedChalakim / CHALAKIM_PER_HOUR);\n adjustedChalakim = adjustedChalakim - hour * CHALAKIM_PER_HOUR;\n const minutes = Math.trunc(adjustedChalakim / CHALAKIM_PER_MINUTE);\n\n if (hour >= 6) {\n hd = hd.next();\n }\n hour = (hour + 18) % 24;\n\n const m: MoladBase = {\n hdate: hd,\n hour,\n minutes,\n chalakim: adjustedChalakim - minutes * CHALAKIM_PER_MINUTE,\n };\n\n return m;\n}\n"],"names":[],"mappings":";;;AAgBA;;;AAGG;AAEH;;;AAGG;AACH,MAAM,YAAY,GAAW,QAAQ;AAErC;AACA,MAAM,mBAAmB,GAAW,EAAE;AAEtC;AACA,MAAM,iBAAiB,GAAW,IAAI;AAEtC;AACA,MAAM,gBAAgB,GAAW,KAAK,CAAC;AAEvC;AAC+E;AAC/E,MAAM,kBAAkB,GAAW,MAAM,CAAC;AAE1C;;;AAGG;AACH,MAAM,mBAAmB,GAAW,KAAK;AAEzC;;;AAGG;AACH,SAAS,oBAAoB,CAAC,IAAY,EAAE,KAAa,EAAA;AACvD,IAAA,MAAM,IAAI,GAAY,UAAU,CAAC,IAAI,CAAC;AACtC,IAAA,OAAO,CAAC,CAAC,KAAK,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,GAAG,EA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