@hebcal/core 6.14.6 → 6.15.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 (65) hide show
  1. package/README.md +26 -1
  2. package/dist/bundle.js +627 -380
  3. package/dist/bundle.js.map +1 -1
  4. package/dist/bundle.min.js +7 -7
  5. package/dist/bundle.min.js.map +1 -1
  6. package/dist/esm/DailyLearning.js +1 -1
  7. package/dist/esm/HebrewDateEvent.js +1 -1
  8. package/dist/esm/HolidayEvent.js +1 -1
  9. package/dist/esm/KiddushLevanaEvent.d.ts +15 -1
  10. package/dist/esm/KiddushLevanaEvent.js +17 -7
  11. package/dist/esm/KiddushLevanaEvent.js.map +1 -1
  12. package/dist/esm/MevarchimChodeshEvent.js +1 -1
  13. package/dist/esm/ParshaEvent.js +1 -1
  14. package/dist/esm/TimedEvent.js +1 -1
  15. package/dist/esm/YomKippurKatanEvent.js +1 -1
  16. package/dist/esm/ashkenazi.po.js +1 -1
  17. package/dist/esm/calendar.js +5 -5
  18. package/dist/esm/calendar.js.map +1 -1
  19. package/dist/esm/candles.js +7 -7
  20. package/dist/esm/candles.js.map +1 -1
  21. package/dist/esm/cities.json.js +1 -1
  22. package/dist/esm/event.js +1 -1
  23. package/dist/esm/getStartAndEnd.js +2 -2
  24. package/dist/esm/getStartAndEnd.js.map +1 -1
  25. package/dist/esm/hallel.js +1 -1
  26. package/dist/esm/he-x-NoNikud.po.js +1 -1
  27. package/dist/esm/he.po.js +1 -1
  28. package/dist/esm/hebcal.js +1 -1
  29. package/dist/esm/holidays.js +1 -1
  30. package/dist/esm/horizon.d.ts +94 -0
  31. package/dist/esm/horizon.js +146 -0
  32. package/dist/esm/horizon.js.map +1 -0
  33. package/dist/esm/index.d.ts +2 -0
  34. package/dist/esm/index.js +1 -1
  35. package/dist/esm/isAssurBemlacha.js +2 -2
  36. package/dist/esm/isAssurBemlacha.js.map +1 -1
  37. package/dist/esm/isAveilut.js +1 -1
  38. package/dist/esm/isFastDay.js +1 -1
  39. package/dist/esm/locale.js +1 -1
  40. package/dist/esm/location.js +3 -3
  41. package/dist/esm/location.js.map +1 -1
  42. package/dist/esm/modern.js +1 -1
  43. package/dist/esm/molad.js +1 -1
  44. package/dist/esm/moladBase.js +1 -1
  45. package/dist/esm/moladDate.js +1 -1
  46. package/dist/esm/omer.js +1 -1
  47. package/dist/esm/parshaName.js +1 -1
  48. package/dist/esm/parshaYear.js +1 -1
  49. package/dist/esm/pkgVersion.d.ts +1 -1
  50. package/dist/esm/pkgVersion.js +2 -2
  51. package/dist/esm/pkgVersion.js.map +1 -1
  52. package/dist/esm/reformatTimeStr.js +1 -1
  53. package/dist/esm/sedra.js +2 -2
  54. package/dist/esm/sedra.js.map +1 -1
  55. package/dist/esm/sefira.json.js +1 -1
  56. package/dist/esm/staticHolidays.js +1 -1
  57. package/dist/esm/string.js +1 -1
  58. package/dist/esm/tachanun.js +1 -1
  59. package/dist/esm/zenith.d.ts +2 -1
  60. package/dist/esm/zenith.js +4 -3
  61. package/dist/esm/zenith.js.map +1 -1
  62. package/dist/esm/zmanim.d.ts +117 -5
  63. package/dist/esm/zmanim.js +209 -15
  64. package/dist/esm/zmanim.js.map +1 -1
  65. package/package.json +12 -12
@@ -1 +1 @@
1
- {"version":3,"file":"candles.js","sources":["../../../src/candles.ts"],"sourcesContent":["import {HDate, months} from '@hebcal/hdate';\nimport {CalOptions} from './CalOptions.js';\nimport {Location} from './location.js';\nimport {Event, flags} from './event.js';\nimport {ChanukahEvent, HolidayEvent} from './HolidayEvent.js';\nimport {Zmanim} from './zmanim.js';\nimport {TimedEvent, CandleLightingEvent, HavdalahEvent} from './TimedEvent.js';\nimport {holidayDesc as hdesc} from './staticHolidays.js';\nimport {DEG_6_POINT_45, DEG_7_POINT_083, DEG_16_POINT_1} from './zenith.js';\n\nconst {LIGHT_CANDLES, LIGHT_CANDLES_TZEIS} = flags;\nconst {FAST_BEGINS, FAST_ENDS} = hdesc;\n\n/** @internal */\nexport function makeCandleEvent(\n ev: Event | undefined,\n hd: HDate,\n options: CalOptions,\n isFriday: boolean,\n isSaturday: boolean\n): TimedEvent | undefined {\n let havdalahTitle = false;\n let useHavdalahOffset = isSaturday;\n let mask = ev ? ev.mask : LIGHT_CANDLES;\n if (ev !== undefined) {\n // if linked event && dow == FRI, use Candle lighting time & title\n if (!isFriday) {\n if (ev.hasAnyFlag('LIGHT_CANDLES_TZEIS', 'CHANUKAH_CANDLES')) {\n useHavdalahOffset = true;\n } else if (ev.hasFlag('YOM_TOV_ENDS')) {\n havdalahTitle = true;\n useHavdalahOffset = true;\n }\n }\n } else if (isSaturday) {\n havdalahTitle = true;\n mask = LIGHT_CANDLES_TZEIS;\n }\n // if Havdalah offset is 0 or undefined, we'll use tzeit time\n const offset = useHavdalahOffset\n ? Number(options.havdalahMins)\n : Number(options.candleLightingMins);\n const location = options.location as Location;\n const useElevation = Boolean(options.useElevation);\n const zmanim = new Zmanim(location, hd, useElevation);\n const time =\n useHavdalahOffset && !offset\n ? zmanim.tzeit(options.havdalahDeg)\n : zmanim.sunsetOffset(offset, true);\n if (isNaN(time.getTime())) {\n return undefined; // no sunset\n }\n if (havdalahTitle) {\n return new HavdalahEvent(\n hd,\n mask,\n time,\n location,\n options.havdalahMins,\n ev,\n options\n );\n } else {\n mask |= LIGHT_CANDLES;\n return new CandleLightingEvent(hd, mask, time, location, ev, options);\n }\n}\n\n/**\n * Minutes after sunset that minor fasts (including Yom Kippur Katan) end in\n * Israel by default, following Rabbi Deblitzky's practice.\n * @see {https://www.yeshiva.org.il/calendar/timeprinciples}\n */\nconst MINOR_FAST_END_MINUTES_IL = 15;\n\n/**\n * Returns `val` when it is a finite nonzero number, otherwise `undefined`\n */\nfunction nonzero(val: number | undefined): number | undefined {\n return typeof val === 'number' && isFinite(val) && val !== 0 ? val : undefined;\n}\n\n/**\n * Computes the \"Fast begins\" time for a minor fast (one that begins at dawn).\n *\n * When `options.fastStartMins` is a nonzero number, the fast begins that many\n * minutes before sunrise; otherwise, when `options.fastStartDeg` is a nonzero\n * number, the fast begins when the sun is that many degrees below the horizon\n * in the morning. By default, minor fasts begin at Alot HaShachar (16.1°).\n */\nfunction makeFastStartTime(zmanim: Zmanim, options: CalOptions): Date {\n const fastStartMins = nonzero(options.fastStartMins);\n if (fastStartMins !== undefined) {\n return zmanim.sunriseOffset(-Math.abs(fastStartMins), true);\n }\n const fastStartDeg = nonzero(options.fastStartDeg);\n return zmanim.timeAtAngle(\n fastStartDeg === undefined ? DEG_16_POINT_1 : Math.abs(fastStartDeg),\n true\n );\n}\n\n/**\n * Computes the \"Fast ends\" time for a fast day.\n *\n * Tish'a B'Av ends `options.tishaBavEndMins` minutes after sunset or at tzeit\n * `options.tishaBavEndDeg` when either is a nonzero number, and otherwise at\n * tzeit 6.45° (Rabbi Yechiel Michel Tucazinsky). It is not affected by\n * `options.fastEndDeg`, `options.fastEndMins` or `options.il`.\n *\n * For minor fasts: when `options.fastEndMins` is a nonzero number, the fast\n * ends that many minutes after sunset; otherwise, when `options.fastEndDeg` is\n * a nonzero number, the fast ends at tzeit for that solar depression angle.\n * When neither is specified, the default depends on `options.il`:\n * - In Israel, minor fasts end 15 minutes after sunset (Rabbi Deblitzky's practice).\n * - Elsewhere, minor fasts end at tzeit 7.083° (3 medium-sized stars).\n */\nfunction makeFastEndTime(\n zmanim: Zmanim,\n isTishaBav: boolean,\n options: CalOptions\n): Date {\n if (isTishaBav) {\n const tishaBavEndMins = nonzero(options.tishaBavEndMins);\n if (tishaBavEndMins !== undefined) {\n return zmanim.sunsetOffset(Math.abs(tishaBavEndMins), true);\n }\n const tishaBavEndDeg = nonzero(options.tishaBavEndDeg);\n return zmanim.tzeit(\n tishaBavEndDeg === undefined ? DEG_6_POINT_45 : Math.abs(tishaBavEndDeg)\n );\n }\n const fastEndMins = options.fastEndMins;\n if (typeof fastEndMins === 'number' && fastEndMins !== 0) {\n return zmanim.sunsetOffset(Math.abs(fastEndMins), true);\n }\n const fastEndDeg = options.fastEndDeg;\n if (typeof fastEndDeg === 'number' && fastEndDeg !== 0) {\n return zmanim.tzeit(Math.abs(fastEndDeg));\n }\n if (options.il) {\n return zmanim.sunsetOffset(MINOR_FAST_END_MINUTES_IL, true);\n }\n return zmanim.tzeit(DEG_7_POINT_083);\n}\n\n/**\n * A fast day holiday with attached start and end time events.\n *\n * Wraps an underlying fast-day {@link HolidayEvent} and (when computable\n * for the given location) exposes a \"Fast begins\" and \"Fast ends\"\n * {@link TimedEvent}. Generated by {@link calendar} when\n * `options.candlelighting` is `true` and `options.location` is provided.\n *\n * - Minor fasts (including Yom Kippur Katan) begin at *Alot HaShachar*\n * (16.1° below horizon in the morning), which can be overridden via\n * `options.fastStartDeg` or `options.fastStartMins`. By default they end at\n * tzeit 7.083° (3 medium-sized stars) in the Diaspora, or 15 minutes after\n * sunset in Israel (Rabbi Deblitzky's practice). This can be overridden\n * via `options.fastEndDeg` or `options.fastEndMins`.\n * - Tish'a B'Av begins at sunset on the previous day, regardless of\n * `options.fastStartDeg` / `options.fastStartMins`. By default it ends at\n * tzeit 6.45° below horizon (Rabbi Yechiel Michel Tucazinsky), which can be\n * overridden via `options.tishaBavEndDeg` or `options.tishaBavEndMins`\n * (but not by `options.fastEndDeg` / `options.fastEndMins`).\n * - When a minor fast falls on a Friday, the end time is suppressed\n * (Shabbat begins before nightfall).\n */\nexport class FastDayEvent extends HolidayEvent {\n /** original event */\n readonly linkedEvent: HolidayEvent;\n /** this will be a \"Fast begins\" event */\n readonly startEvent?: TimedEvent;\n /** this will be a \"Fast ends\" event */\n readonly endEvent?: TimedEvent;\n constructor(\n linkedEvent: HolidayEvent,\n startEvent?: TimedEvent,\n endEvent?: TimedEvent\n ) {\n super(linkedEvent.getDate(), linkedEvent.getDesc(), linkedEvent.mask);\n this.linkedEvent = linkedEvent;\n this.startEvent = startEvent;\n this.endEvent = endEvent;\n }\n override render(locale?: string): string {\n return this.linkedEvent.render(locale);\n }\n override renderBrief(locale?: string): string {\n return this.linkedEvent.renderBrief(locale);\n }\n override urlDateSuffix(): string {\n return this.linkedEvent.urlDateSuffix();\n }\n override url(): string | undefined {\n return this.linkedEvent.url();\n }\n override getEmoji(): string {\n return this.linkedEvent.getEmoji();\n }\n override getCategories(): string[] {\n return this.linkedEvent.getCategories();\n }\n}\n\n/**\n * Makes a pair of events representing fast start and end times\n * @internal\n */\nexport function makeFastStartEnd(\n ev: HolidayEvent,\n options: CalOptions\n): FastDayEvent {\n const desc = ev.getDesc();\n if (desc === 'Yom Kippur') {\n throw new RangeError('YK does not require this function');\n }\n const hd = ev.getDate();\n const dt = hd.greg();\n const location = options.location as Location;\n const useElevation = Boolean(options.useElevation);\n const zmanim = new Zmanim(location, dt, useElevation);\n let startEvent: TimedEvent | undefined;\n let endEvent: TimedEvent | undefined;\n if (desc === \"Erev Tish'a B'Av\") {\n const sunset = zmanim.sunset();\n if (!isNaN(sunset.getTime())) {\n startEvent = makeTimedEvent(ev, sunset, FAST_BEGINS, options);\n }\n } else if (desc.startsWith(\"Tish'a B'Av\")) {\n const fastEnd = makeFastEndTime(zmanim, true, options);\n if (!isNaN(fastEnd.getTime())) {\n endEvent = makeTimedEvent(ev, fastEnd, FAST_ENDS, options);\n }\n } else {\n const fastStart = makeFastStartTime(zmanim, options);\n if (!isNaN(fastStart.getTime())) {\n startEvent = makeTimedEvent(ev, fastStart, FAST_BEGINS, options);\n }\n if (\n dt.getDay() !== 5 &&\n !(hd.getDate() === 14 && hd.getMonth() === months.NISAN)\n ) {\n const fastEnd = makeFastEndTime(zmanim, false, options);\n if (!isNaN(fastEnd.getTime())) {\n endEvent = makeTimedEvent(ev, fastEnd, FAST_ENDS, options);\n }\n }\n }\n const ev2 = new FastDayEvent(ev, startEvent, endEvent);\n // copy properties such as memo or emoji\n Object.assign(ev2, ev);\n return ev2;\n}\n\nfunction makeTimedEvent(\n ev: Event,\n time: Date,\n desc: string,\n options: CalOptions\n): TimedEvent {\n const location = options.location as Location;\n const hd = ev.getDate();\n return new TimedEvent(hd, desc, ev.mask, time, location, ev, options);\n}\n\n/**\n * A Chanukah candle-lighting event that carries a specific time of day.\n *\n * Generated by {@link calendar} when both `options.candlelighting`\n * and `options.location` are set. On weekdays the time is Bein HaShmashos\n * (13.5 minutes before the sun is 7.083° below the horizon in the evening);\n * on Friday it is regular candle-lighting time, and on Saturday night it is\n * regular Havdalah time.\n */\nexport class TimedChanukahEvent extends ChanukahEvent {\n /** Time at which candles are lit, rounded to the nearest minute */\n eventTime: Date;\n /** {@link eventTime} formatted for the event's location, e.g. `'4:31pm'` */\n eventTimeStr: string;\n /** Location used to calculate {@link eventTime} */\n readonly location: Location;\n /**\n * Normally created by {@link calendar} rather than directly.\n * @param ev the untimed Chanukah event this is derived from\n * @param eventTime time at which candles are lit\n * @param location location used to format the time\n */\n constructor(ev: ChanukahEvent, eventTime: Date, location: Location) {\n super(ev.getDate(), ev.getDesc(), ev.mask, ev.chanukahDay);\n this.eventTime = Zmanim.roundTime(eventTime);\n const timeFormat = location.getTimeFormatter();\n this.eventTimeStr = Zmanim.formatTime(this.eventTime, timeFormat);\n this.location = location;\n this.emoji = ev.emoji;\n }\n}\n\n/**\n * Makes a candle-lighting event for Chankah (not on Friday/Saturday).\n * At one point this used civil dusk (6 degrees below horizon).\n * Another source suggests 4.6667 degrees below horizon.\n * @internal\n */\nexport function makeWeekdayChanukahCandleLighting(\n ev: ChanukahEvent,\n options: CalOptions\n): TimedChanukahEvent | null {\n const hd = ev.getDate();\n const location = options.location as Location;\n const useElevation = Boolean(options.useElevation);\n const zmanim = new Zmanim(location, hd.greg(), useElevation);\n const candleLightingTime = zmanim.beinHaShmashos();\n if (isNaN(candleLightingTime.getTime())) {\n return null;\n }\n return new TimedChanukahEvent(ev, candleLightingTime, location);\n}\n"],"names":["hdesc"],"mappings":";;;;;;;;;AAUA,MAAM,EAAC,aAAa,EAAE,mBAAmB,EAAC,GAAG,KAAK;AAClD,MAAM,EAAC,WAAW,EAAE,SAAS,EAAC,GAAGA,WAAK;AAEtC;AAC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QAAQ,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE,YAAY,CAAC;AAC5D,IAAA,MAAM,kBAAkB,GAAG,MAAM,CAAC,cAAc,EAAE;IAClD,IAAI,KAAK,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC,EAAE;AACvC,QAAA,OAAO,IAAI;IACb;IACA,OAAO,IAAI,kBAAkB,CAAC,EAAE,EAAE,kBAAkB,EAAE,QAAQ,CAAC;AACjE;;"}
1
+ {"version":3,"file":"candles.js","sources":["../../../src/candles.ts"],"sourcesContent":["import {HDate, months} from '@hebcal/hdate';\nimport {CalOptions} from './CalOptions.js';\nimport {Location} from './location.js';\nimport {Event, flags} from './event.js';\nimport {ChanukahEvent, HolidayEvent} from './HolidayEvent.js';\nimport {Zmanim} from './zmanim.js';\nimport {TimedEvent, CandleLightingEvent, HavdalahEvent} from './TimedEvent.js';\nimport {holidayDesc as hdesc} from './staticHolidays.js';\nimport {DEG_6_POINT_45, DEG_7_POINT_083, DEG_16_POINT_1} from './zenith.js';\n\nconst {LIGHT_CANDLES, LIGHT_CANDLES_TZEIS} = flags;\nconst {FAST_BEGINS, FAST_ENDS} = hdesc;\n\n/** @internal */\nexport function makeCandleEvent(\n ev: Event | undefined,\n hd: HDate,\n options: CalOptions,\n isFriday: boolean,\n isSaturday: boolean\n): TimedEvent | undefined {\n let havdalahTitle = false;\n let useHavdalahOffset = isSaturday;\n let mask = ev ? ev.mask : LIGHT_CANDLES;\n if (ev !== undefined) {\n // if linked event && dow == FRI, use Candle lighting time & title\n if (!isFriday) {\n if (ev.hasAnyFlag('LIGHT_CANDLES_TZEIS', 'CHANUKAH_CANDLES')) {\n useHavdalahOffset = true;\n } else if (ev.hasFlag('YOM_TOV_ENDS')) {\n havdalahTitle = true;\n useHavdalahOffset = true;\n }\n }\n } else if (isSaturday) {\n havdalahTitle = true;\n mask = LIGHT_CANDLES_TZEIS;\n }\n // if Havdalah offset is 0 or undefined, we'll use tzeit time\n const offset = useHavdalahOffset\n ? Number(options.havdalahMins)\n : Number(options.candleLightingMins);\n const location = options.location as Location;\n const useElevation = Boolean(options.useElevation);\n const zmanim = new Zmanim(location, hd, useElevation);\n const time =\n useHavdalahOffset && !offset\n ? zmanim.tzeit(options.havdalahDeg)\n : zmanim.sunsetOffset(offset, true);\n if (Number.isNaN(time.getTime())) {\n return undefined; // no sunset\n }\n if (havdalahTitle) {\n return new HavdalahEvent(\n hd,\n mask,\n time,\n location,\n options.havdalahMins,\n ev,\n options\n );\n } else {\n mask |= LIGHT_CANDLES;\n return new CandleLightingEvent(hd, mask, time, location, ev, options);\n }\n}\n\n/**\n * Minutes after sunset that minor fasts (including Yom Kippur Katan) end in\n * Israel by default, following Rabbi Deblitzky's practice.\n * @see {https://www.yeshiva.org.il/calendar/timeprinciples}\n */\nconst MINOR_FAST_END_MINUTES_IL = 15;\n\n/**\n * Returns `val` when it is a finite nonzero number, otherwise `undefined`\n */\nfunction nonzero(val: number | undefined): number | undefined {\n return typeof val === 'number' && isFinite(val) && val !== 0 ? val : undefined;\n}\n\n/**\n * Computes the \"Fast begins\" time for a minor fast (one that begins at dawn).\n *\n * When `options.fastStartMins` is a nonzero number, the fast begins that many\n * minutes before sunrise; otherwise, when `options.fastStartDeg` is a nonzero\n * number, the fast begins when the sun is that many degrees below the horizon\n * in the morning. By default, minor fasts begin at Alot HaShachar (16.1°).\n */\nfunction makeFastStartTime(zmanim: Zmanim, options: CalOptions): Date {\n const fastStartMins = nonzero(options.fastStartMins);\n if (fastStartMins !== undefined) {\n return zmanim.sunriseOffset(-Math.abs(fastStartMins), true);\n }\n const fastStartDeg = nonzero(options.fastStartDeg);\n return zmanim.timeAtAngle(\n fastStartDeg === undefined ? DEG_16_POINT_1 : Math.abs(fastStartDeg),\n true\n );\n}\n\n/**\n * Computes the \"Fast ends\" time for a fast day.\n *\n * Tish'a B'Av ends `options.tishaBavEndMins` minutes after sunset or at tzeit\n * `options.tishaBavEndDeg` when either is a nonzero number, and otherwise at\n * tzeit 6.45° (Rabbi Yechiel Michel Tucazinsky). It is not affected by\n * `options.fastEndDeg`, `options.fastEndMins` or `options.il`.\n *\n * For minor fasts: when `options.fastEndMins` is a nonzero number, the fast\n * ends that many minutes after sunset; otherwise, when `options.fastEndDeg` is\n * a nonzero number, the fast ends at tzeit for that solar depression angle.\n * When neither is specified, the default depends on `options.il`:\n * - In Israel, minor fasts end 15 minutes after sunset (Rabbi Deblitzky's practice).\n * - Elsewhere, minor fasts end at tzeit 7.083° (3 medium-sized stars).\n */\nfunction makeFastEndTime(\n zmanim: Zmanim,\n isTishaBav: boolean,\n options: CalOptions\n): Date {\n if (isTishaBav) {\n const tishaBavEndMins = nonzero(options.tishaBavEndMins);\n if (tishaBavEndMins !== undefined) {\n return zmanim.sunsetOffset(Math.abs(tishaBavEndMins), true);\n }\n const tishaBavEndDeg = nonzero(options.tishaBavEndDeg);\n return zmanim.tzeit(\n tishaBavEndDeg === undefined ? DEG_6_POINT_45 : Math.abs(tishaBavEndDeg)\n );\n }\n const fastEndMins = options.fastEndMins;\n if (typeof fastEndMins === 'number' && fastEndMins !== 0) {\n return zmanim.sunsetOffset(Math.abs(fastEndMins), true);\n }\n const fastEndDeg = options.fastEndDeg;\n if (typeof fastEndDeg === 'number' && fastEndDeg !== 0) {\n return zmanim.tzeit(Math.abs(fastEndDeg));\n }\n if (options.il) {\n return zmanim.sunsetOffset(MINOR_FAST_END_MINUTES_IL, true);\n }\n return zmanim.tzeit(DEG_7_POINT_083);\n}\n\n/**\n * A fast day holiday with attached start and end time events.\n *\n * Wraps an underlying fast-day {@link HolidayEvent} and (when computable\n * for the given location) exposes a \"Fast begins\" and \"Fast ends\"\n * {@link TimedEvent}. Generated by {@link calendar} when\n * `options.candlelighting` is `true` and `options.location` is provided.\n *\n * - Minor fasts (including Yom Kippur Katan) begin at *Alot HaShachar*\n * (16.1° below horizon in the morning), which can be overridden via\n * `options.fastStartDeg` or `options.fastStartMins`. By default they end at\n * tzeit 7.083° (3 medium-sized stars) in the Diaspora, or 15 minutes after\n * sunset in Israel (Rabbi Deblitzky's practice). This can be overridden\n * via `options.fastEndDeg` or `options.fastEndMins`.\n * - Tish'a B'Av begins at sunset on the previous day, regardless of\n * `options.fastStartDeg` / `options.fastStartMins`. By default it ends at\n * tzeit 6.45° below horizon (Rabbi Yechiel Michel Tucazinsky), which can be\n * overridden via `options.tishaBavEndDeg` or `options.tishaBavEndMins`\n * (but not by `options.fastEndDeg` / `options.fastEndMins`).\n * - When a minor fast falls on a Friday, the end time is suppressed\n * (Shabbat begins before nightfall).\n */\nexport class FastDayEvent extends HolidayEvent {\n /** original event */\n readonly linkedEvent: HolidayEvent;\n /** this will be a \"Fast begins\" event */\n readonly startEvent?: TimedEvent;\n /** this will be a \"Fast ends\" event */\n readonly endEvent?: TimedEvent;\n constructor(\n linkedEvent: HolidayEvent,\n startEvent?: TimedEvent,\n endEvent?: TimedEvent\n ) {\n super(linkedEvent.getDate(), linkedEvent.getDesc(), linkedEvent.mask);\n this.linkedEvent = linkedEvent;\n this.startEvent = startEvent;\n this.endEvent = endEvent;\n }\n override render(locale?: string): string {\n return this.linkedEvent.render(locale);\n }\n override renderBrief(locale?: string): string {\n return this.linkedEvent.renderBrief(locale);\n }\n override urlDateSuffix(): string {\n return this.linkedEvent.urlDateSuffix();\n }\n override url(): string | undefined {\n return this.linkedEvent.url();\n }\n override getEmoji(): string {\n return this.linkedEvent.getEmoji();\n }\n override getCategories(): string[] {\n return this.linkedEvent.getCategories();\n }\n}\n\n/**\n * Makes a pair of events representing fast start and end times\n * @internal\n */\nexport function makeFastStartEnd(\n ev: HolidayEvent,\n options: CalOptions\n): FastDayEvent {\n const desc = ev.getDesc();\n if (desc === 'Yom Kippur') {\n throw new RangeError('YK does not require this function');\n }\n const hd = ev.getDate();\n const dt = hd.greg();\n const location = options.location as Location;\n const useElevation = Boolean(options.useElevation);\n const zmanim = new Zmanim(location, dt, useElevation);\n let startEvent: TimedEvent | undefined;\n let endEvent: TimedEvent | undefined;\n if (desc === \"Erev Tish'a B'Av\") {\n const sunset = zmanim.sunset();\n if (!Number.isNaN(sunset.getTime())) {\n startEvent = makeTimedEvent(ev, sunset, FAST_BEGINS, options);\n }\n } else if (desc.startsWith(\"Tish'a B'Av\")) {\n const fastEnd = makeFastEndTime(zmanim, true, options);\n if (!Number.isNaN(fastEnd.getTime())) {\n endEvent = makeTimedEvent(ev, fastEnd, FAST_ENDS, options);\n }\n } else {\n const fastStart = makeFastStartTime(zmanim, options);\n if (!Number.isNaN(fastStart.getTime())) {\n startEvent = makeTimedEvent(ev, fastStart, FAST_BEGINS, options);\n }\n if (\n dt.getDay() !== 5 &&\n !(hd.getDate() === 14 && hd.getMonth() === months.NISAN)\n ) {\n const fastEnd = makeFastEndTime(zmanim, false, options);\n if (!Number.isNaN(fastEnd.getTime())) {\n endEvent = makeTimedEvent(ev, fastEnd, FAST_ENDS, options);\n }\n }\n }\n const ev2 = new FastDayEvent(ev, startEvent, endEvent);\n // copy properties such as memo or emoji\n Object.assign(ev2, ev);\n return ev2;\n}\n\nfunction makeTimedEvent(\n ev: Event,\n time: Date,\n desc: string,\n options: CalOptions\n): TimedEvent {\n const location = options.location as Location;\n const hd = ev.getDate();\n return new TimedEvent(hd, desc, ev.mask, time, location, ev, options);\n}\n\n/**\n * A Chanukah candle-lighting event that carries a specific time of day.\n *\n * Generated by {@link calendar} when both `options.candlelighting`\n * and `options.location` are set. On weekdays the time is Bein HaShmashos\n * (13.5 minutes before the sun is 7.083° below the horizon in the evening);\n * on Friday it is regular candle-lighting time, and on Saturday night it is\n * regular Havdalah time.\n */\nexport class TimedChanukahEvent extends ChanukahEvent {\n /** Time at which candles are lit, rounded to the nearest minute */\n eventTime: Date;\n /** {@link eventTime} formatted for the event's location, e.g. `'4:31pm'` */\n eventTimeStr: string;\n /** Location used to calculate {@link eventTime} */\n readonly location: Location;\n /**\n * Normally created by {@link calendar} rather than directly.\n * @param ev the untimed Chanukah event this is derived from\n * @param eventTime time at which candles are lit\n * @param location location used to format the time\n */\n constructor(ev: ChanukahEvent, eventTime: Date, location: Location) {\n super(ev.getDate(), ev.getDesc(), ev.mask, ev.chanukahDay);\n this.eventTime = Zmanim.roundTime(eventTime);\n const timeFormat = location.getTimeFormatter();\n this.eventTimeStr = Zmanim.formatTime(this.eventTime, timeFormat);\n this.location = location;\n this.emoji = ev.emoji;\n }\n}\n\n/**\n * Makes a candle-lighting event for Chankah (not on Friday/Saturday).\n * At one point this used civil dusk (6 degrees below horizon).\n * Another source suggests 4.6667 degrees below horizon.\n * @internal\n */\nexport function makeWeekdayChanukahCandleLighting(\n ev: ChanukahEvent,\n options: CalOptions\n): TimedChanukahEvent | null {\n const hd = ev.getDate();\n const location = options.location as Location;\n const useElevation = Boolean(options.useElevation);\n const zmanim = new Zmanim(location, hd.greg(), useElevation);\n const candleLightingTime = zmanim.beinHaShmashos();\n if (Number.isNaN(candleLightingTime.getTime())) {\n return null;\n }\n return new TimedChanukahEvent(ev, candleLightingTime, location);\n}\n"],"names":["hdesc"],"mappings":";;;;;;;;;AAUA,MAAM,EAAC,aAAa,EAAE,mBAAmB,EAAC,GAAG,KAAK;AAClD,MAAM,EAAC,WAAW,EAAE,SAAS,EAAC,GAAGA,WAAK;AAEtC;AACM,SAAU,eAAe,CAC7B,EAAqB,EACrB,EAAS,EACT,OAAmB,EACnB,QAAiB,EACjB,UAAmB,EAAA;IAEnB,IAAI,aAAa,GAAG,KAAK;IACzB,IAAI,iBAAiB,GAAG,UAAU;AAClC,IAAA,IAAI,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,GAAG,aAAa;AACvC,IAAA,IAAI,EAAE,KAAK,SAAS,EAAE;;QAEpB,IAAI,CAAC,QAAQ,EAAE;YACb,IAAI,EAAE,CAAC,UAAU,CAAC,qBAAqB,EAAE,kBAAkB,CAAC,EAAE;gBAC5D,iBAAiB,GAAG,IAAI;YAC1B;AAAO,iBAAA,IAAI,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE;gBACrC,aAA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PLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  var citiesJson = [
3
3
  "Ashdod|IL|31.79213|34.64966|Asia/Jerusalem|27",
4
4
  "Atlanta|US|33.749|-84.38798|America/New_York|336",
package/dist/esm/event.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.14.6, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.15.0, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { HDate, Locale } from '@hebcal/hdate';
3
3
  import './locale.js';
4
4
 
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.14.6, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.15.0, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { months, isDate, greg2abs, HDate, daysInGregMonth } from '@hebcal/hdate';
3
3
 
4
4
  const { TISHREI } = months;
@@ -42,7 +42,7 @@ function getStartAndEnd(options) {
42
42
  }
43
43
  const isHebrewYear = Boolean(options.isHebrewYear);
44
44
  const theYear = getYear(options);
45
- if (isNaN(theYear)) {
45
+ if (Number.isNaN(theYear)) {
46
46
  throw new RangeError(`Invalid year ${options.year}`);
47
47
  }
48
48
  if (isHebrewYear && theYear < 1) {
@@ -1 +1 @@
1
- {"version":3,"file":"getStartAndEnd.js","sources":["../../../src/getStartAndEnd.ts"],"sourcesContent":["import {greg2abs, isDate, daysInGregMonth, HDate, months} from '@hebcal/hdate';\nimport {CalOptions} from './CalOptions.js';\n\nconst {TISHREI} = months;\n\n/**\n * Gets the R.D. days for a number, Date, or HDate\n */\nfunction getAbs(d: Date | HDate | number): number {\n if (typeof d === 'number') return d;\n if (isDate(d)) return greg2abs(d);\n if (HDate.isHDate(d)) return d.abs();\n throw new TypeError(`Invalid date type: ${d}`);\n}\n\nfunction getYear(options: CalOptions): number {\n if (options.year !== undefined) {\n return Number(options.year);\n }\n return options.isHebrewYear\n ? new HDate().getFullYear()\n : new Date().getFullYear();\n}\n\nconst MAX_NUM_YEARS = 2000;\n\n/**\n * Parse options object to determine start & end days\n * @internal\n */\nexport function getStartAndEnd(options: CalOptions): number[] {\n const {start: start0, end: end0} = options;\n if ((start0 === undefined) !== (end0 === undefined)) {\n throw new TypeError('options.start requires options.end');\n }\n if (start0 !== undefined && end0 !== undefined) {\n const start = getAbs(start0);\n const end = getAbs(end0);\n if (end - start > 365 * MAX_NUM_YEARS) {\n throw new RangeError(`Date range exceeds ${MAX_NUM_YEARS} years`);\n }\n return [start, end];\n }\n const isHebrewYear = Boolean(options.isHebrewYear);\n const theYear = getYear(options);\n if (isNaN(theYear)) {\n throw new RangeError(`Invalid year ${options.year}`);\n }\n if (isHebrewYear && theYear < 1) {\n throw new RangeError(`Invalid Hebrew year ${theYear}`);\n }\n const theMonth = getMonth(options);\n const numYears = Number(options.numYears) || 1;\n if (numYears > MAX_NUM_YEARS) {\n throw new RangeError(`options.numYears exceeds ${MAX_NUM_YEARS}`);\n }\n if (isHebrewYear) {\n return startEndHebrew(theMonth, theYear, numYears);\n } else {\n return startEndGregorian(theMonth, theYear, numYears);\n }\n}\n\nfunction getMonth(options: CalOptions): number {\n if (options.month) {\n if (options.isHebrewYear) {\n return HDate.monthNum(options.month);\n }\n if (typeof options.month === 'number') {\n return options.month;\n }\n }\n return NaN;\n}\n\nfunction startEndGregorian(\n theMonth: number,\n theYear: number,\n numYears: number\n): number[] {\n const gregMonth = theMonth ? theMonth - 1 : 0;\n const startGreg = new Date(theYear, gregMonth, 1);\n if (theYear < 100) {\n startGreg.setFullYear(theYear);\n }\n const startAbs = greg2abs(startGreg);\n let endAbs: number;\n if (theMonth) {\n endAbs = startAbs + daysInGregMonth(theMonth, theYear) - 1;\n } else {\n const endYear = theYear + numYears;\n const endGreg = new Date(endYear, 0, 1);\n if (endYear < 100) {\n endGreg.setFullYear(endYear);\n }\n endAbs = greg2abs(endGreg) - 1;\n }\n return [startAbs, endAbs];\n}\n\nfunction startEndHebrew(\n theMonth: number,\n theYear: number,\n numYears: number\n): number[] {\n const startDate = new HDate(1, theMonth || TISHREI, theYear);\n let startAbs = startDate.abs();\n const endAbs = theMonth\n ? startAbs + startDate.daysInMonth()\n : new HDate(1, TISHREI, theYear + numYears).abs() - 1;\n // for full Hebrew year, start on Erev Rosh Hashana which\n // is technically in the previous Hebrew year\n // (but conveniently lets us get candle-lighting time for Erev)\n if (!theMonth && theYear > 1) {\n startAbs--;\n }\n return [startAbs, endAbs];\n}\n"],"names":[],"mappings":";;;AAGA,MAAM,EAAC,OAAO,EAAC,GAAG,MAAM;AAExB;;AAEG;AACH,SAAS,MAAM,CAAC,CAAwB,EAAA;IACtC,IAAI,OAAO,CAAC,KAAK,QAAQ;AAAE,QAAA,OAAO,CAAC;IACnC,IAAI,MAAM,CAAC,CAAC,CAAC;AAAE,QAAA,OAAO,QAAQ,CAAC,CAAC,CAAC;AACjC,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AAAE,QAAA,OAAO,CAAC,CAAC,GAAG,EAAE;AACpC,IAAA,MAAM,IAAI,SAAS,CAAC,sBAAsB,CAAC,CAAA,CAAE,CAAC;AAChD;AAEA,SAAS,OAAO,CAAC,OAAmB,EAAA;AAClC,IAAA,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE;AAC9B,QAAA,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;IAC7B;IACA,OAAO,OAAO,CAAC;AACb,UAAE,IAAI,KAAK,EAAE,CAAC,WAAW;AACzB,UAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;AAC9B;AAEA,MAAM,aAAa,GAAG,IAAI;AAE1B;;;AAGG;AACG,SAAU,cAAc,CAAC,OAAmB,EAAA;IAChD,MAAM,EAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAC,GAAG,OAAO;AAC1C,IAAA,IAAI,CAAC,MAAM,KA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AAc,CACrB,QAAgB,EAChB,OAAe,EACf,QAAgB,EAAA;AAEhB,IAAA,MAAM,SAAS,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,QAAQ,IAAI,OAAO,EAAE,OAAO,CAAC;AAC5D,IAAA,IAAI,QAAQ,GAAG,SAAS,CAAC,GAAG,EAAE;IAC9B,MAAM,MAAM,GAAG;AACb,UAAE,QAAQ,GAAG,SAAS,CAAC,WAAW;AAClC,UAAE,IAAI,KAAK,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,QAAQ,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC;;;;AAIvD,IAAA,IAAI,CAAC,QAAQ,IAAI,OAAO,GAAG,CAAC,EAAE;AAC5B,QAAA,QAAQ,EAAE;IACZ;AACA,IAAA,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC;AAC3B;;"}
1
+ {"version":3,"file":"getStartAndEnd.js","sources":["../../../src/getStartAndEnd.ts"],"sourcesContent":["import {greg2abs, isDate, daysInGregMonth, HDate, months} from '@hebcal/hdate';\nimport {CalOptions} from './CalOptions.js';\n\nconst {TISHREI} = months;\n\n/**\n * Gets the R.D. days for a number, Date, or HDate\n */\nfunction getAbs(d: Date | HDate | number): number {\n if (typeof d === 'number') return d;\n if (isDate(d)) return greg2abs(d);\n if (HDate.isHDate(d)) return d.abs();\n throw new TypeError(`Invalid date type: ${d}`);\n}\n\nfunction getYear(options: CalOptions): number {\n if (options.year !== undefined) {\n return Number(options.year);\n }\n return options.isHebrewYear\n ? new HDate().getFullYear()\n : new Date().getFullYear();\n}\n\nconst MAX_NUM_YEARS = 2000;\n\n/**\n * Parse options object to determine start & end days\n * @internal\n */\nexport function getStartAndEnd(options: CalOptions): number[] {\n const {start: start0, end: end0} = options;\n if ((start0 === undefined) !== (end0 === undefined)) {\n throw new TypeError('options.start requires options.end');\n }\n if (start0 !== undefined && end0 !== undefined) {\n const start = getAbs(start0);\n const end = getAbs(end0);\n if (end - start > 365 * MAX_NUM_YEARS) {\n throw new RangeError(`Date range exceeds ${MAX_NUM_YEARS} years`);\n }\n return [start, end];\n }\n const isHebrewYear = Boolean(options.isHebrewYear);\n const theYear = getYear(options);\n if (Number.isNaN(theYear)) {\n throw new RangeError(`Invalid year ${options.year}`);\n }\n if (isHebrewYear && theYear < 1) {\n throw new RangeError(`Invalid Hebrew year ${theYear}`);\n }\n const theMonth = getMonth(options);\n const numYears = Number(options.numYears) || 1;\n if (numYears > MAX_NUM_YEARS) {\n throw new RangeError(`options.numYears exceeds ${MAX_NUM_YEARS}`);\n }\n if (isHebrewYear) {\n return startEndHebrew(theMonth, theYear, numYears);\n } else {\n return startEndGregorian(theMonth, theYear, numYears);\n }\n}\n\nfunction getMonth(options: CalOptions): number {\n if (options.month) {\n if (options.isHebrewYear) {\n return HDate.monthNum(options.month);\n }\n if (typeof options.month === 'number') {\n return options.month;\n }\n }\n return NaN;\n}\n\nfunction startEndGregorian(\n theMonth: number,\n theYear: number,\n numYears: number\n): number[] {\n const gregMonth = theMonth ? theMonth - 1 : 0;\n const startGreg = new Date(theYear, gregMonth, 1);\n if (theYear < 100) {\n startGreg.setFullYear(theYear);\n }\n const startAbs = greg2abs(startGreg);\n let endAbs: number;\n if (theMonth) {\n endAbs = startAbs + daysInGregMonth(theMonth, theYear) - 1;\n } else {\n const endYear = theYear + numYears;\n const endGreg = new Date(endYear, 0, 1);\n if (endYear < 100) {\n endGreg.setFullYear(endYear);\n }\n endAbs = greg2abs(endGreg) - 1;\n }\n return [startAbs, endAbs];\n}\n\nfunction startEndHebrew(\n theMonth: number,\n theYear: number,\n numYears: number\n): number[] {\n const startDate = new HDate(1, theMonth || TISHREI, theYear);\n let startAbs = startDate.abs();\n const endAbs = theMonth\n ? startAbs + startDate.daysInMonth()\n : new HDate(1, TISHREI, theYear + numYears).abs() - 1;\n // for full Hebrew year, start on Erev Rosh Hashana which\n // is technically in the previous Hebrew year\n // (but conveniently lets us get candle-lighting time for Erev)\n if (!theMonth && theYear > 1) {\n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C,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,QAAQ,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC;;;;AAIvD,IAAA,IAAI,CAAC,QAAQ,IAAI,OAAO,GAAG,CAAC,EAAE;AAC5B,QAAA,QAAQ,EAAE;IACZ;AACA,IAAA,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC;AAC3B;;"}
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.14.6, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.15.0, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { months } from '@hebcal/hdate';
3
3
  import { holidayDesc } from './staticHolidays.js';
4
4
 
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.14.6, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.15.0, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  var noNikudOverride = { "headers": { "plural-forms": "nplurals=2; plural=(n != 1);", "language": "he-x-NoNikud" }, "contexts": { "": { "Korach": ["קורח"], "Chukat": ["חוקת"], "Erev Yom Kippur": ["ערב יום כיפור"], "Yom Kippur": ["יום כיפור"], "Yom Kippur Katan": ["יום כיפור קטן"], "Pesach Shabbat Chol ha-Moed": ["שבת חול המועד פסח"], "Sukkot Shabbat Chol ha-Moed": ["שבת חול המועד סוכות"], "Erev Sukkot": ["ערב סוכות"], "Sukkot": ["סוכות"], "Sukkot I": ["סוכות א׳"], "Sukkot II": ["סוכות ב׳"], "Sukkot II (CH''M)": ["סוכות ב׳ (חוה״מ)"], "Sukkot III (CH''M)": ["סוכות ג׳ (חוה״מ)"], "Sukkot IV (CH''M)": ["סוכות ד׳ (חוה״מ)"], "Sukkot V (CH''M)": ["סוכות ה׳ (חוה״מ)"], "Sukkot VI (CH''M)": ["סוכות ו׳ (חוה״מ)"], "Sukkot VII (Hoshana Raba)": ["סוכות ז׳ (הושענא רבה)"], "Swords of Iron War Memorial Day": ["יום הזיכרון לחללי מלחמת חרבות ברזל"], "Latest Kiddush Levana": ["סוף זמן קידוש לבנה"] } } };
3
3
 
4
4
  export { noNikudOverride as default };
package/dist/esm/he.po.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.14.6, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.15.0, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  var poHe = { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);", "language": "he_IL" }, "contexts": { "": { "Shabbat": ["שַׁבָּת"], "Parashat": ["פָּרָשַׁת"], "Achrei Mot": ["אַחֲרֵי מוֹת"], "Balak": ["בָּלָק"], "Bamidbar": ["בְּמִדְבַּר"], "Bechukotai": ["בְּחֻקֹּתַי"], "Beha'alotcha": ["בְּהַעֲלֹתְךָ"], "Behar": ["בְּהַר"], "Bereshit": ["בְּרֵאשִׁית"], "Beshalach": ["בְּשַׁלַּח"], "Bo": ["בֹּא"], "Chayei Sara": ["חַיֵּי שָֹרָה"], "Chukat": ["חֻקַּת"], "Devarim": ["דְּבָרִים"], "Eikev": ["עֵקֶב"], "Emor": ["אֱמוֹר"], "Ha'azinu": ["הַאֲזִינוּ"], "Kedoshim": ["קְדֹשִׁים"], "Ki Tavo": ["כִּי־תָבוֹא"], "Ki Teitzei": ["כִּי־תֵצֵא"], "Ki Tisa": ["כִּי תִשָּׂא"], "Korach": ["קֹרַח"], "Lech-Lecha": ["לֶךְ־לְךָ"], "Masei": ["מַסְעֵי"], "Matot": ["מַטּוֹת"], "Metzora": ["מְצֹרָע"], "Miketz": ["מִקֵּץ"], "Mishpatim": ["מִשְׁפָּטִים"], "Nasso": ["נָשׂא"], "Nitzavim": ["נִצָּבִים"], "Noach": ["נֹחַ"], "Pekudei": ["פְקוּדֵי"], "Pinchas": ["פִּינְחָס"], "Re'eh": ["רְאֵה"], "Sh'lach": ["שְׁלַח־לְךָ"], "Shemot": ["שְׁמוֹת"], "Shmini": ["שְּׁמִינִי"], "Shoftim": ["שׁוֹפְטִים"], "Tazria": ["תַזְרִיעַ"], "Terumah": ["תְּרוּמָה"], "Tetzaveh": ["תְּצַוֶּה"], "Toldot": ["תּוֹלְדוֹת"], "Tzav": ["צַו"], "Vaera": ["וָאֵרָא"], "Vaetchanan": ["וָאֶתְחַנַּן"], "Vayakhel": ["וַיַּקְהֵל"], "Vayechi": ["וַיְחִי"], "Vayeilech": ["וַיֵּלֶךְ"], "Vayera": ["וַיֵּרָא"], "Vayeshev": ["וַיֵּשֶׁב"], "Vayetzei": ["וַיֵּצֵא"], "Vayigash": ["וַיִּגַּשׁ"], "Vayikra": ["וַיִּקְרָא"], "Vayishlach": ["וַיִּשְׁלַח"], "Vezot Haberakhah": ["וְזֹאת הַבְּרָכָה"], "Yitro": ["יִתְרוֹ"], "Asara B'Tevet": ["עֲשָׂרָה בְּטֵבֵת"], "Candle lighting": ["הַדְלָקַת נֵרוֹת"], "Chanukah": ["חֲנוּכָּה"], "Chanukah: 1 Candle": ["חֲנוּכָּה: א׳ נֵר"], "Chanukah: 2 Candles": ["חֲנוּכָּה: ב׳ נֵרוֹת"], "Chanukah: 3 Candles": ["חֲנוּכָּה: ג׳ נֵרוֹת"], "Chanukah: 4 Candles": ["חֲנוּכָּה: ד׳ נֵרוֹת"], "Chanukah: 5 Candles": ["חֲנוּכָּה: ה׳ נֵרוֹת"], "Chanukah: 6 Candles": ["חֲנוּכָּה: ו׳ נֵרוֹת"], "Chanukah: 7 Candles": ["חֲנוּכָּה: ז׳ נֵרוֹת"], "Chanukah: 8 Candles": ["חֲנוּכָּה: ח׳ נֵרוֹת"], "Chanukah: 8th Day": ["חֲנוּכָּה: יוֹם ח׳"], "Days of the Omer": ["סְפִירַת הָעוֹמֶר"], "Omer": ["עוֹמֶר"], "day of the Omer": ["בָּעוֹמֶר"], "Erev Pesach": ["עֶרֶב פֶּסַח"], "Erev Purim": ["עֶרֶב פּוּרִים"], "Erev Rosh Hashana": ["עֶרֶב רֹאשׁ הַשָּׁנָה"], "Erev Shavuot": ["עֶרֶב שָׁבוּעוֹת"], "Erev Simchat Torah": ["עֶרֶב שִׂמְחַת תּוֹרָה"], "Erev Sukkot": ["עֶרֶב סֻכּוֹת"], "Erev Tish'a B'Av": ["עֶרֶב תִּשְׁעָה בְּאָב"], "Erev Yom Kippur": ["עֶרֶב יוֹם כִּפּוּר"], "Havdalah": ["הַבְדָּלָה"], "Lag BaOmer": ["ל״ג בָּעוֹמֶר"], "Leil Selichot": ["סְלִיחוֹת"], "Pesach": ["פֶּסַח"], "Pesach I": ["פֶּסַח א׳"], "Pesach II": ["פֶּסַח ב׳"], "Pesach II (CH''M)": ["פֶּסַח ב׳ (חוה״מ)"], "Pesach III (CH''M)": ["פֶּסַח ג׳ (חוה״מ)"], "Pesach IV (CH''M)": ["פֶּסַח ד׳ (חוה״מ)"], "Pesach Sheni": ["פֶּסַח שֵׁנִי"], "Pesach V (CH''M)": ["פֶּסַח ה׳ (חוה״מ)"], "Pesach VI (CH''M)": ["פֶּסַח ו׳ (חוה״מ)"], "Pesach VII": ["פֶּסַח ז׳"], "Pesach VIII": ["פֶּסַח ח׳"], "Pesach Shabbat Chol ha-Moed": ["שַׁבַּת חֹל הַמּוֹעֵד פֶּסַח"], "Purim": ["פּוּרִים"], "Purim Katan": ["פּוּרִים קָטָן"], "Rosh Chodesh": ["רֹאשׁ חוֹדֶשׁ"], "Rosh Hashana": ["רֹאשׁ הַשָּׁנָה"], "Rosh Hashana I": ["רֹאשׁ הַשָּׁנָה א׳"], "Rosh Hashana II": ["רֹאשׁ הַשָּׁנָה ב׳"], "Shabbat Chazon": ["שַׁבַּת חֲזוֹן"], "Shabbat HaChodesh": ["שַׁבַּת הַחֹדֶשׁ"], "Shabbat HaGadol": ["שַׁבַּת הַגָּדוֹל"], "Shabbat Nachamu": ["שַׁבַּת נַחֲמוּ"], "Shabbat Parah": ["שַׁבַּת פָּרָה"], "Shabbat Shekalim": ["שַׁבַּת שְׁקָלִים"], "Shabbat Shuva": ["שַׁבַּת שׁוּבָה"], "Shabbat Zachor": ["שַׁבַּת זָכוֹר"], "Shavuot": ["שָׁבוּעוֹת"], "Shavuot I": ["שָׁבוּעוֹת א׳"], "Shavuot II": ["שָׁבוּעוֹת ב׳"], "Shmini Atzeret": ["שְׁמִינִי עֲצֶרֶת"], "Shushan Purim": ["שׁוּשָׁן פּוּרִים"], "Sigd": ["חַג הַסִּיגְד"], "Simchat Torah": ["שִׂמְחַת תּוֹרָה"], "Sukkot": ["סֻכּוֹת"], "Sukkot I": ["סֻכּוֹת א׳"], "Sukkot II": ["סֻכּוֹת ב׳"], "Sukkot II (CH''M)": ["סֻכּוֹת ב׳ (חוה״מ)"], "Sukkot III (CH''M)": ["סֻכּוֹת ג׳ (חוה״מ)"], "Sukkot IV (CH''M)": ["סֻכּוֹת ד׳ (חוה״מ)"], "Sukkot V (CH''M)": ["סֻכּוֹת ה׳ (חוה״מ)"], "Sukkot VI (CH''M)": ["סֻכּוֹת ו׳ (חוה״מ)"], "Sukkot VII (Hoshana Raba)": ["סֻכּוֹת ז׳ (הוֹשַׁעְנָא רַבָּה)"], "Sukkot Shabbat Chol ha-Moed": ["שַׁבַּת חֹל הַמּוֹעֵד סֻכּוֹת"], "Ta'anit Bechorot": ["תַּעֲנִית בְּכוֹרוֹת"], "Ta'anit BeHaB": ["תַּעֲנִית בה״ב"], "Ta'anit Esther": ["תַּעֲנִית אֶסְתֵּר"], "Tish'a B'Av": ["תִּשְׁעָה בְּאָב"], "Tu B'Av": ["ט״וּ בְּאָב"], "Tu BiShvat": ["ט״וּ בִּשְׁבָט"], "Tu B'Shvat": ["ט״וּ בִּשְׁבָט"], "Tzom Gedaliah": ["צוֹם גְּדַלְיָה"], "Tzom Tammuz": ["צוֹם י״ז בְּתַמּוּז"], "Yom HaAtzma'ut": ["יוֹם הָעַצְמָאוּת"], "Yom HaShoah": ["יוֹם הַשּׁוֹאָה"], "Yom HaZikaron": ["יוֹם הַזִּכָּרוֹן"], "Yom Kippur": ["יוֹם כִּפּוּר"], "Yom Yerushalayim": ["יוֹם יְרוּשָׁלַיִם"], "Yom HaAliyah": ["יוֹם הַעֲלִיָּה"], "Yom HaAliyah School Observance": ["שְׁמִירָת בֵּית הַסֵפֶר לְיוֹם הַעֲלִיָּה"], "Rosh Chodesh Adar": ["רֹאשׁ חוֹדֶשׁ אֲדָר"], "Rosh Chodesh Adar I": ["רֹאשׁ חוֹדֶשׁ אֲדָר א׳"], "Rosh Chodesh Adar II": ["רֹאשׁ חוֹדֶשׁ אֲדָר ב׳"], "Rosh Chodesh Av": ["רֹאשׁ חוֹדֶשׁ אָב"], "Rosh Chodesh Cheshvan": ["רֹאשׁ חוֹדֶשׁ חֶשְׁוָן"], "Rosh Chodesh Elul": ["רֹאשׁ חוֹדֶשׁ אֱלוּל"], "Rosh Chodesh Iyyar": ["רֹאשׁ חוֹדֶשׁ אִיָּיר"], "Rosh Chodesh Kislev": ["רֹאשׁ חוֹדֶשׁ כִּסְלֵו"], "Rosh Chodesh Nisan": ["רֹאשׁ חוֹדֶשׁ נִיסָן"], "Rosh Chodesh Sh'vat": ["רֹאשׁ חוֹדֶשׁ שְׁבָט"], "Rosh Chodesh Sivan": ["רֹאשׁ חוֹדֶשׁ סִיוָן"], "Rosh Chodesh Tamuz": ["רֹאשׁ חוֹדֶשׁ תַּמּוּז"], "Rosh Chodesh Tammuz": ["רֹאשׁ חוֹדֶשׁ תַּמּוּז"], "Rosh Chodesh Tevet": ["רֹאשׁ חוֹדֶשׁ טֵבֵת"], "min": ["דַּקּוֹת"], "Fast begins": ["תְּחִילַּת הַצוֹם"], "Fast ends": ["סִיּוּם הַצוֹם"], "Rosh Hashana LaBehemot": ["רֹאשׁ הַשָּׁנָה לְמַעְשַׂר בְּהֵמָה"], "Tish'a B'Av (observed)": ["(תִּשְׁעָה בְּאָב (נִדְחָה"], "Shabbat Mevarchim Chodesh": ["שַׁבַּת מְבָרְכִים חוֹדֶשׁ"], "Shabbat Shirah": ["שַׁבַּת שִׁירָה"], "Lovingkindness": ["חֶסֶד"], "Might": ["גְּבוּרָה"], "Beauty": ["תִּפְאֶרֶת"], "Eternity": ["נֶּצַח"], "Splendor": ["הוֹד"], "Foundation": ["יְּסוֹד"], "Majesty": ["מַּלְכוּת"], "day": ["יוֹם"], "Yom Kippur Katan": ["יוֹם כִּפּוּר קָטָן"], "Yizkor": ["יִזְכּוֹר"], "Family Day": ["יוֹם הַמִּשׁפָּחָה"], "Yitzhak Rabin Memorial Day": ["יוֹם הַזִּכָּרוֹן לְיִצְחָק רַבִּין"], "Jabotinsky Day": ["יוֹם זַ׳בּוֹטִינְסְקִי"], "Herzl Day": ["יוֹם הֶרְצְל"], "Ben-Gurion Day": ["יוֹם בֶּן־גּוּרִיּוֹן"], "Hebrew Language Day": ["יוֹם הַשָׂפָה הַעִברִית"], "Birkat Hachamah": ["בִּרְכַּת הַחַמָּה"], "Birkat HaChamah": ["בִּרְכַּת הַחַמָּה"], "Shushan Purim Katan": ["שׁוּשָׁן פּוּרִים קָטָן"], "Purim Meshulash": ["פּוּרִים מְשׁוּלָּשׁ"], "Chag HaBanot": ["חַג הַבָּנוֹת"], "Molad": ["מוֹלָד הָלְּבָנָה"], "chalakim": ["חֲלָקִים"], "Alot HaShachar": ["עֲלוֹת הַשַּׁחַר"], "Misheyakir": ["מִשֶּׁיַּכִּיר"], "Misheyakir Machmir": ["מִשֶּׁיַּכִּיר מַחְמִיר"], "Sunrise": ["נֵץ הַחַמָּה"], "Kriat Shema, sof zeman": ["סוֹף זְמַן קְרִיאַת שְׁמַע"], "Tefilah, sof zeman": ["סוֹף זְמַן תְּפִלָּה"], "Kriat Shema, sof zeman (MGA)": ["סוֹף זְמַן קְרִיאַת שְׁמַע (מג״א)"], "Kriat Shema, sof zeman (GRA)": ["סוֹף זְמַן קְרִיאַת שְׁמַע (גְּרָ״א)"], "Tefilah, sof zeman (MGA)": ["סוֹף זְמַן תְּפִלָּה (מג״א)"], "Tefilah, sof zeman (GRA)": ["סוֹף זְמַן תְּפִלָּה (גְּרָ״א)"], "Chatzot HaLailah": ["חֲצוֹת הַלַּיְלָה"], "Chatzot HaYom": ["חֲצוֹת הַיּוֹם"], "Chatzot hayom": ["חֲצוֹת הַיּוֹם"], "Mincha Gedolah": ["מִנְחָה גְּדוֹלָה"], "Mincha Ketanah": ["מִנְחָה קְטַנָּה"], "Plag HaMincha": ["פְּלַג הַמִּנְחָה"], "Sunset": ["שְׁקִיעַת הַחַמָּה"], "Bein HaShemashot": ["בֵּין הַשְּׁמָשׁוֹת"], "Tzeit HaKochavim": ["צֵאת הַכּוֹכָבִים"], "Biur Chametz": ["בִּעוּר חָמֵץ"], "Finish eating chametz": ["סוֹף זְמַן אֲכִילַת חָמֵץ"], "Swords of Iron War Memorial Day": ["יוֹם הַזִּכָּרוֹן לְחַלְלֵי מִלְחֶמֶת חַרְבוֹת בַּרְזֶל"], "Latest Kiddush Levana": ["סוֹף זְמַן קִדּוּשׁ לְבָנָה"] } } };
3
3
 
4
4
  export { poHe as default };
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.14.6, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.15.0, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { birthdayOrAnniversary, yahrzeit, HDate } from '@hebcal/hdate';
3
3
  import './locale.js';
4
4
  import { version } from './pkgVersion.js';
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.14.6, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.15.0, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { months, HDate } from '@hebcal/hdate';
3
3
  import QuickLRU from 'quick-lru';
4
4
  import { flags } from './event.js';
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Pure arithmetic for the "visible" sunrise/sunset (_netz ha-nireh_,
3
+ * הנץ הנראה): resolving a caller-supplied terrain horizon profile, atmospheric
4
+ * refraction, and the apparent altitude of the sun's upper limb.
5
+ *
6
+ * The method follows Keller & Hall, _Using a digital terrain model to
7
+ * calculate visual sunrise and sunset times_, Computers & Geosciences 26
8
+ * (2000) 991–1000, https://doi.org/10.1016/S0098-3004(00)00058-3 (a copy is
9
+ * hosted at http://www.chaitables.com/DblHallpaperpub.htm), and their part II,
10
+ * Computers & Geosciences 162 (2022) 105044,
11
+ * https://doi.org/10.1016/j.cageo.2022.105044, which re-examines the
12
+ * refraction model with ray tracing and finds the standard formulas adequate.
13
+ * It matches the conventions of the Chai Tables (https://www.chaitables.com),
14
+ * the authors' public service that computes these times for the printed
15
+ * Israeli calendars; their conventions are described at
16
+ * http://www.chaitables.com/Introduction_to_DTM_calculations.html.
17
+ *
18
+ * Refraction uses the Sinclair model below 15° and the Bennett model at or
19
+ * above 15°, both at standard atmosphere (1010 hPa, 10 °C), matching the Chai
20
+ * Tables. Bennett's formula is from G. G. Bennett, _The calculation of
21
+ * astronomical refraction in marine navigation_, Journal of Navigation 35
22
+ * (1982) 255–259, https://doi.org/10.1017/S0373463300022037; Sinclair's
23
+ * low-altitude formula is the one given in the _Explanatory Supplement to the
24
+ * Astronomical Almanac_ (ed. Seidelmann, 1992), §3.283, and both are
25
+ * reproduced in Keller & Hall (2000). "Visible" means the moment the sun's
26
+ * _upper limb_ (semidiameter 16′), bent up by refraction, first clears
27
+ * (sunrise) or last touches (sunset) the real skyline. No cushion or safety
28
+ * margin is added — the raw computed instant is returned (the Chai Tables add
29
+ * 20 seconds).
30
+ *
31
+ * This module is pure: it depends on nothing from `@hebcal/noaa` and performs
32
+ * no I/O. The horizon profile is always supplied by the caller; building one
33
+ * from terrain / digital-elevation-model data is outside this library.
34
+ */
35
+ /**
36
+ * One measured point of a horizon profile: the apparent angular altitude of
37
+ * the skyline in a single compass direction.
38
+ */
39
+ export interface HorizonSample {
40
+ /**
41
+ * Degrees clockwise from true north: 0 = N, 90 = E, 180 = S, 270 = W.
42
+ */
43
+ azimuth: number;
44
+ /**
45
+ * Apparent angular altitude of the highest obstruction in that direction,
46
+ * in degrees above the observer's astronomical horizon (negative where the
47
+ * horizon dips below it, e.g. the sea seen from a height).
48
+ */
49
+ elevation: number;
50
+ }
51
+ /**
52
+ * The apparent altitude of the skyline as a function of compass azimuth. May
53
+ * be one of:
54
+ *
55
+ * - a constant `number` — the same elevation in every direction;
56
+ * - a non-empty list of {@link HorizonSample}s in any order or spacing, with
57
+ * azimuths in `[0, 360)`, linearly interpolated (wrapping past 360°/0°);
58
+ * - a function `(azimuth: number) => number` returning the elevation in
59
+ * degrees for a given azimuth.
60
+ */
61
+ export type HorizonProfile = number | readonly HorizonSample[] | ((azimuth: number) => number);
62
+ /**
63
+ * The sun's angular semidiameter in degrees (16 arcminutes), matching the
64
+ * value `@hebcal/noaa` folds into its `GEOMETRIC_ZENITH` adjustment.
65
+ */
66
+ export declare const SOLAR_SEMIDIAMETER: number;
67
+ /**
68
+ * Resolves a {@link HorizonProfile} at a single azimuth.
69
+ *
70
+ * A constant returns itself; a function is invoked; a sample list is linearly
71
+ * interpolated between its two neighbouring samples by azimuth, wrapping
72
+ * around 360°/0°. A single sample behaves as a constant.
73
+ * @param profile the horizon profile
74
+ * @param azimuth degrees clockwise from true north
75
+ * @throws {TypeError} for an empty sample array or a non-finite constant
76
+ */
77
+ export declare function horizonElevation(profile: HorizonProfile, azimuth: number): number;
78
+ /**
79
+ * Atmospheric refraction at a given apparent altitude, in degrees, at standard
80
+ * atmosphere (1010 hPa, 10 °C). Sinclair's formula below 15°, Bennett's at or
81
+ * above 15° — the pairing the Chai Tables use.
82
+ * @param apparentAltitude apparent altitude of the body above the horizon, in degrees
83
+ */
84
+ export declare function refractionAtApparentAltitude(apparentAltitude: number): number;
85
+ /**
86
+ * Given the sun's geometric centre altitude, returns the apparent altitude of
87
+ * its upper limb — adding the semidiameter and solving the implicit
88
+ * refraction equation `β = a + SD + R(β)` by fixed-point iteration.
89
+ *
90
+ * `upperLimbApparentAltitude(-0.8333)` is ≈ 0, i.e. the standard sea-level
91
+ * sunrise/sunset definition (upper limb on the astronomical horizon).
92
+ * @param centerGeometricAltitude geometric altitude of the sun's centre, in degrees
93
+ */
94
+ export declare function upperLimbApparentAltitude(centerGeometricAltitude: number): number;
@@ -0,0 +1,146 @@
1
+ /*! @hebcal/core v6.15.0, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
+ /**
3
+ * Pure arithmetic for the "visible" sunrise/sunset (_netz ha-nireh_,
4
+ * הנץ הנראה): resolving a caller-supplied terrain horizon profile, atmospheric
5
+ * refraction, and the apparent altitude of the sun's upper limb.
6
+ *
7
+ * The method follows Keller & Hall, _Using a digital terrain model to
8
+ * calculate visual sunrise and sunset times_, Computers & Geosciences 26
9
+ * (2000) 991–1000, https://doi.org/10.1016/S0098-3004(00)00058-3 (a copy is
10
+ * hosted at http://www.chaitables.com/DblHallpaperpub.htm), and their part II,
11
+ * Computers & Geosciences 162 (2022) 105044,
12
+ * https://doi.org/10.1016/j.cageo.2022.105044, which re-examines the
13
+ * refraction model with ray tracing and finds the standard formulas adequate.
14
+ * It matches the conventions of the Chai Tables (https://www.chaitables.com),
15
+ * the authors' public service that computes these times for the printed
16
+ * Israeli calendars; their conventions are described at
17
+ * http://www.chaitables.com/Introduction_to_DTM_calculations.html.
18
+ *
19
+ * Refraction uses the Sinclair model below 15° and the Bennett model at or
20
+ * above 15°, both at standard atmosphere (1010 hPa, 10 °C), matching the Chai
21
+ * Tables. Bennett's formula is from G. G. Bennett, _The calculation of
22
+ * astronomical refraction in marine navigation_, Journal of Navigation 35
23
+ * (1982) 255–259, https://doi.org/10.1017/S0373463300022037; Sinclair's
24
+ * low-altitude formula is the one given in the _Explanatory Supplement to the
25
+ * Astronomical Almanac_ (ed. Seidelmann, 1992), §3.283, and both are
26
+ * reproduced in Keller & Hall (2000). "Visible" means the moment the sun's
27
+ * _upper limb_ (semidiameter 16′), bent up by refraction, first clears
28
+ * (sunrise) or last touches (sunset) the real skyline. No cushion or safety
29
+ * margin is added — the raw computed instant is returned (the Chai Tables add
30
+ * 20 seconds).
31
+ *
32
+ * This module is pure: it depends on nothing from `@hebcal/noaa` and performs
33
+ * no I/O. The horizon profile is always supplied by the caller; building one
34
+ * from terrain / digital-elevation-model data is outside this library.
35
+ */
36
+ /**
37
+ * The sun's angular semidiameter in degrees (16 arcminutes), matching the
38
+ * value `@hebcal/noaa` folds into its `GEOMETRIC_ZENITH` adjustment.
39
+ */
40
+ const SOLAR_SEMIDIAMETER = 16 / 60;
41
+ /**
42
+ * Resolves a {@link HorizonProfile} at a single azimuth.
43
+ *
44
+ * A constant returns itself; a function is invoked; a sample list is linearly
45
+ * interpolated between its two neighbouring samples by azimuth, wrapping
46
+ * around 360°/0°. A single sample behaves as a constant.
47
+ * @param profile the horizon profile
48
+ * @param azimuth degrees clockwise from true north
49
+ * @throws {TypeError} for an empty sample array or a non-finite constant
50
+ */
51
+ function horizonElevation(profile, azimuth) {
52
+ if (typeof profile === 'number') {
53
+ if (!Number.isFinite(profile)) {
54
+ throw new TypeError(`invalid horizon elevation: ${profile}`);
55
+ }
56
+ return profile;
57
+ }
58
+ if (typeof profile === 'function') {
59
+ return profile(azimuth);
60
+ }
61
+ const n = profile.length;
62
+ if (n === 0) {
63
+ throw new TypeError('horizon profile has no samples');
64
+ }
65
+ if (n === 1) {
66
+ return profile[0].elevation;
67
+ }
68
+ const sorted = [...profile].sort((a, b) => a.azimuth - b.azimuth);
69
+ let az = azimuth % 360;
70
+ if (az < 0) {
71
+ az += 360;
72
+ }
73
+ // Largest sample azimuth that is still <= the query azimuth.
74
+ let loIdx = -1;
75
+ for (let i = 0; i < n; i++) {
76
+ if (sorted[i].azimuth <= az) {
77
+ loIdx = i;
78
+ }
79
+ else {
80
+ break;
81
+ }
82
+ }
83
+ let lo;
84
+ let hi;
85
+ let loAz;
86
+ let hiAz;
87
+ if (loIdx === -1) {
88
+ // Below the smallest azimuth: wrap, previous neighbour is the last sample.
89
+ lo = sorted[n - 1];
90
+ loAz = lo.azimuth - 360;
91
+ hi = sorted[0];
92
+ hiAz = hi.azimuth;
93
+ }
94
+ else if (loIdx === n - 1) {
95
+ // At or above the largest azimuth: wrap, next neighbour is the first.
96
+ lo = sorted[n - 1];
97
+ loAz = lo.azimuth;
98
+ hi = sorted[0];
99
+ hiAz = hi.azimuth + 360;
100
+ }
101
+ else {
102
+ lo = sorted[loIdx];
103
+ loAz = lo.azimuth;
104
+ hi = sorted[loIdx + 1];
105
+ hiAz = hi.azimuth;
106
+ }
107
+ const t = hiAz === loAz ? 0 : (az - loAz) / (hiAz - loAz);
108
+ return lo.elevation + t * (hi.elevation - lo.elevation);
109
+ }
110
+ /**
111
+ * Atmospheric refraction at a given apparent altitude, in degrees, at standard
112
+ * atmosphere (1010 hPa, 10 °C). Sinclair's formula below 15°, Bennett's at or
113
+ * above 15° — the pairing the Chai Tables use.
114
+ * @param apparentAltitude apparent altitude of the body above the horizon, in degrees
115
+ */
116
+ function refractionAtApparentAltitude(apparentAltitude) {
117
+ const P = 1010;
118
+ const T = 10;
119
+ const a = apparentAltitude;
120
+ if (a < 15) {
121
+ return (((P / (T + 273)) * (0.1594 + 0.0196 * a + 0.00002 * a * a)) /
122
+ (1 + 0.505 * a + 0.0845 * a * a));
123
+ }
124
+ return (((1 / 60) * (P / 1010) * (283 / (273 + T))) /
125
+ Math.tan(((a + 7.31 / (a + 4.4)) * Math.PI) / 180));
126
+ }
127
+ /**
128
+ * Given the sun's geometric centre altitude, returns the apparent altitude of
129
+ * its upper limb — adding the semidiameter and solving the implicit
130
+ * refraction equation `β = a + SD + R(β)` by fixed-point iteration.
131
+ *
132
+ * `upperLimbApparentAltitude(-0.8333)` is ≈ 0, i.e. the standard sea-level
133
+ * sunrise/sunset definition (upper limb on the astronomical horizon).
134
+ * @param centerGeometricAltitude geometric altitude of the sun's centre, in degrees
135
+ */
136
+ function upperLimbApparentAltitude(centerGeometricAltitude) {
137
+ const base = centerGeometricAltitude + SOLAR_SEMIDIAMETER;
138
+ let beta = base + refractionAtApparentAltitude(base);
139
+ for (let i = 0; i < 4; i++) {
140
+ beta = base + refractionAtApparentAltitude(beta);
141
+ }
142
+ return beta;
143
+ }
144
+
145
+ export { SOLAR_SEMIDIAMETER, horizonElevation, refractionAtApparentAltitude, upperLimbApparentAltitude };
146
+ //# sourceMappingURL=horizon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"horizon.js","sources":["../../../src/horizon.ts"],"sourcesContent":["/**\n * Pure arithmetic for the \"visible\" sunrise/sunset (_netz ha-nireh_,\n * הנץ הנראה): resolving a caller-supplied terrain horizon profile, atmospheric\n * refraction, and the apparent altitude of the sun's upper limb.\n *\n * The method follows Keller & Hall, _Using a digital terrain model to\n * calculate visual sunrise and sunset times_, Computers & Geosciences 26\n * (2000) 991–1000, https://doi.org/10.1016/S0098-3004(00)00058-3 (a copy is\n * hosted at http://www.chaitables.com/DblHallpaperpub.htm), and their part II,\n * Computers & Geosciences 162 (2022) 105044,\n * https://doi.org/10.1016/j.cageo.2022.105044, which re-examines the\n * refraction model with ray tracing and finds the standard formulas adequate.\n * It matches the conventions of the Chai Tables (https://www.chaitables.com),\n * the authors' public service that computes these times for the printed\n * Israeli calendars; their conventions are described at\n * http://www.chaitables.com/Introduction_to_DTM_calculations.html.\n *\n * Refraction uses the Sinclair model below 15° and the Bennett model at or\n * above 15°, both at standard atmosphere (1010 hPa, 10 °C), matching the Chai\n * Tables. Bennett's formula is from G. G. Bennett, _The calculation of\n * astronomical refraction in marine navigation_, Journal of Navigation 35\n * (1982) 255–259, https://doi.org/10.1017/S0373463300022037; Sinclair's\n * low-altitude formula is the one given in the _Explanatory Supplement to the\n * Astronomical Almanac_ (ed. Seidelmann, 1992), §3.283, and both are\n * reproduced in Keller & Hall (2000). \"Visible\" means the moment the sun's\n * _upper limb_ (semidiameter 16′), bent up by refraction, first clears\n * (sunrise) or last touches (sunset) the real skyline. No cushion or safety\n * margin is added — the raw computed instant is returned (the Chai Tables add\n * 20 seconds).\n *\n * This module is pure: it depends on nothing from `@hebcal/noaa` and performs\n * no I/O. The horizon profile is always supplied by the caller; building one\n * from terrain / digital-elevation-model data is outside this library.\n */\n\n/**\n * One measured point of a horizon profile: the apparent angular altitude of\n * the skyline in a single compass direction.\n */\nexport interface HorizonSample {\n /**\n * Degrees clockwise from true north: 0 = N, 90 = E, 180 = S, 270 = W.\n */\n azimuth: number;\n /**\n * Apparent angular altitude of the highest obstruction in that direction,\n * in degrees above the observer's astronomical horizon (negative where the\n * horizon dips below it, e.g. the sea seen from a height).\n */\n elevation: number;\n}\n\n/**\n * The apparent altitude of the skyline as a function of compass azimuth. May\n * be one of:\n *\n * - a constant `number` — the same elevation in every direction;\n * - a non-empty list of {@link HorizonSample}s in any order or spacing, with\n * azimuths in `[0, 360)`, linearly interpolated (wrapping past 360°/0°);\n * - a function `(azimuth: number) => number` returning the elevation in\n * degrees for a given azimuth.\n */\nexport type HorizonProfile =\n number | readonly HorizonSample[] | ((azimuth: number) => number);\n\n/**\n * The sun's angular semidiameter in degrees (16 arcminutes), matching the\n * value `@hebcal/noaa` folds into its `GEOMETRIC_ZENITH` adjustment.\n */\nexport const SOLAR_SEMIDIAMETER = 16 / 60;\n\n/**\n * Resolves a {@link HorizonProfile} at a single azimuth.\n *\n * A constant returns itself; a function is invoked; a sample list is linearly\n * interpolated between its two neighbouring samples by azimuth, wrapping\n * around 360°/0°. A single sample behaves as a constant.\n * @param profile the horizon profile\n * @param azimuth degrees clockwise from true north\n * @throws {TypeError} for an empty sample array or a non-finite constant\n */\nexport function horizonElevation(profile: HorizonProfile, azimuth: number): number {\n if (typeof profile === 'number') {\n if (!Number.isFinite(profile)) {\n throw new TypeError(`invalid horizon elevation: ${profile}`);\n }\n return profile;\n }\n if (typeof profile === 'function') {\n return profile(azimuth);\n }\n const n = profile.length;\n if (n === 0) {\n throw new TypeError('horizon profile has no samples');\n }\n if (n === 1) {\n return profile[0].elevation;\n }\n const sorted = [...profile].sort((a, b) => a.azimuth - b.azimuth);\n let az = azimuth % 360;\n if (az < 0) {\n az += 360;\n }\n // Largest sample azimuth that is still <= the query azimuth.\n let loIdx = -1;\n for (let i = 0; i < n; i++) {\n if (sorted[i].azimuth <= az) {\n loIdx = i;\n } else {\n break;\n }\n }\n let lo: HorizonSample;\n let hi: HorizonSample;\n let loAz: number;\n let hiAz: number;\n if (loIdx === -1) {\n // Below the smallest azimuth: wrap, previous neighbour is the last sample.\n lo = sorted[n - 1];\n loAz = lo.azimuth - 360;\n hi = sorted[0];\n hiAz = hi.azimuth;\n } else if (loIdx === n - 1) {\n // At or above the largest azimuth: wrap, next neighbour is the first.\n lo = sorted[n - 1];\n loAz = lo.azimuth;\n hi = sorted[0];\n hiAz = hi.azimuth + 360;\n } else {\n lo = sorted[loIdx];\n loAz = lo.azimuth;\n hi = sorted[loIdx + 1];\n hiAz = hi.azimuth;\n }\n const t = hiAz === loAz ? 0 : (az - loAz) / (hiAz - loAz);\n return lo.elevation + t * (hi.elevation - lo.elevation);\n}\n\n/**\n * Atmospheric refraction at a given apparent altitude, in degrees, at standard\n * atmosphere (1010 hPa, 10 °C). Sinclair's formula below 15°, Bennett's at or\n * above 15° — the pairing the Chai Tables use.\n * @param apparentAltitude apparent altitude of the body above the horizon, in degrees\n */\nexport function refractionAtApparentAltitude(apparentAltitude: number): number {\n const P = 1010;\n const T = 10;\n const a = apparentAltitude;\n if (a < 15) {\n return (\n ((P / (T + 273)) * (0.1594 + 0.0196 * a + 0.00002 * a * a)) /\n (1 + 0.505 * a + 0.0845 * a * a)\n );\n }\n return (\n ((1 / 60) * (P / 1010) * (283 / (273 + T))) /\n Math.tan(((a + 7.31 / (a + 4.4)) * Math.PI) / 180)\n );\n}\n\n/**\n * Given the sun's geometric centre altitude, returns the apparent altitude of\n * its upper limb — adding the semidiameter and solving the implicit\n * refraction equation `β = a + SD + R(β)` by fixed-point iteration.\n *\n * `upperLimbApparentAltitude(-0.8333)` is ≈ 0, i.e. the standard sea-level\n * sunrise/sunset definition (upper limb on the astronomical horizon).\n * @param centerGeometricAltitude geometric altitude of the sun's centre, in degrees\n */\nexport function upperLimbApparentAltitude(centerGeometricAltitude: number): number {\n const base = centerGeometricAltitude + SOLAR_SEMIDIAMETER;\n let beta = base + refractionAtApparentAltitude(base);\n for (let i = 0; i < 4; i++) {\n beta = base + refractionAtApparentAltitude(beta);\n }\n return beta;\n}\n"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCG;AAgCH;;;AAGG;AACI,MAAM,kBAAkB,GAAG,EAAE,GAAG;AAEvC;;;;;;;;;AASG;AACG,SAAU,gBAAgB,CAAC,OAAuB,EAAE,OAAe,EAAA;AACvE,IAAA,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;AAC7B,YAAA,MAAM,IAAI,SAAS,CAAC,8BAA8B,OAAO,CAAA,CAAE,CAAC;QAC9D;AACA,QAAA,OAAO,OAAO;IAChB;AACA,IAAA,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;AACjC,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC;IACzB;AACA,IAAA,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM;AACxB,IAAA,IAAI,CAAC,KAAK,CAAC,EAAE;AACX,QAAA,MAAM,IAAI,SAAS,CAAC,gCAAgC,CAAC;IACvD;AACA,IAAA,IAAI,CAAC,KAAK,CAAC,EAAE;AACX,QAAA,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS;IAC7B;IACA,MAAM,MAAM,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC;AACj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@ export { gematriya, gematriyaStrToNum } from '@hebcal/hdate';
3
3
  export { greg, months, HDate, Locale, type Headers, type StringArrayMap, type LocaleData, type MonthName, } from '@hebcal/hdate';
4
4
  import './locale.js';
5
5
  export { type CalOptions, type DailyLearningValue } from './CalOptions.js';
6
+ export { type HorizonProfile, type HorizonSample } from './horizon.js';
6
7
  export { HebrewDateEvent } from './HebrewDateEvent.js';
7
8
  export { Event, type FlagName, flags } from './event.js';
8
9
  export { GeoLocation, NOAACalculator } from '@hebcal/noaa';
@@ -17,6 +18,7 @@ export { type MoladBase, calculateMolad } from './moladBase.js';
17
18
  export { getMoladAsDate } from './moladDate.js';
18
19
  export { Molad, MoladEvent } from './molad.js';
19
20
  export { KiddushLevanaEvent } from './KiddushLevanaEvent.js';
21
+ export type { KiddushLevanaAdjustment } from './KiddushLevanaEvent.js';
20
22
  export { OmerEvent, type OmerLang } from './omer.js';
21
23
  export { type TachanunResult, tachanun } from './tachanun.js';
22
24
  export { Sedra, type SedraResult, type NumberOrString, parshiot, getSedra, } from './sedra.js';
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.14.6, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.15.0, distributed under GPLv2 or later 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,4 +1,4 @@
1
- /*! @hebcal/core v6.14.6, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.15.0, distributed under GPLv2 or later 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';
@@ -59,7 +59,7 @@ function isAssurBemlacha(currentTime, location, useElevation) {
59
59
  // erev shabbos, YT or YT sheni and after shkiah
60
60
  const sunset = zmanim.sunset();
61
61
  const sunsetMillis = sunset.getTime();
62
- if (isNaN(sunsetMillis)) {
62
+ if (Number.isNaN(sunsetMillis)) {
63
63
  throw new Error('Could not determine sunset');
64
64
  }
65
65
  // erev shabbos, YT or YT sheni and after shkiah
@@ -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} from './event.js';\n\nfunction isTomorrowShabbosOrYomTov(dow: number, events: Event[]): boolean {\n return (\n dow === 5 ||\n events.some(ev => ev.hasAnyFlag('LIGHT_CANDLES', 'LIGHT_CANDLES_TZEIS'))\n );\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 return dow === 6 || events.some(ev => ev.hasFlag('CHAG'));\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;IAC7D,QACE,GAAG,KAAK,CAAC;AACT,QAAA,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,UAAU,CAAC,eAAe,EAAE,qBAAqB,CAAC,CAAC;AAE5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AAO,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
+ {"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 return (\n dow === 5 ||\n events.some(ev => ev.hasAnyFlag('LIGHT_CANDLES', 'LIGHT_CANDLES_TZEIS'))\n );\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 return dow === 6 || events.some(ev => ev.hasFlag('CHAG'));\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 (Number.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();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,EAAE;AAC9B,IAAA,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,EAAE;AACrC,IAAA,IAAI,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE;AAC9B,QAAA,MAAM,IAAI,KAAK,CAAC,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.14.6, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.15.0, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { months, HDate } from '@hebcal/hdate';
3
3
 
4
4
  const { NISAN, SIVAN, TAMUZ, AV } = months;
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.14.6, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.15.0, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { getHolidaysOnDate } from './holidays.js';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.14.6, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.15.0, distributed under GPLv2 or later 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.14.6, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.15.0, distributed under GPLv2 or later 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';
@@ -131,11 +131,11 @@ class Location extends GeoLocation {
131
131
  */
132
132
  constructor(latitude, longitude, il, tzid, cityName, countryCode, geoid, elevation) {
133
133
  const lat = typeof latitude === 'number' ? latitude : parseFloat(latitude);
134
- if (isNaN(lat) || lat < -90 || lat > 90) {
134
+ if (Number.isNaN(lat) || lat < -90 || lat > 90) {
135
135
  throw new RangeError(`Latitude ${latitude} out of range [-90,90]`);
136
136
  }
137
137
  const long = typeof longitude === 'number' ? longitude : parseFloat(longitude);
138
- if (isNaN(long) || long < -180 || long > 180) {
138
+ if (Number.isNaN(long) || long < -180 || long > 180) {
139
139
  throw new RangeError(`Longitude ${longitude} out of range [-180,180]`);
140
140
  }
141
141
  if (!tzid) {