@hebcal/core 6.14.6 → 6.14.7

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 (59) hide show
  1. package/README.md +1 -1
  2. package/dist/bundle.js +34 -30
  3. package/dist/bundle.js.map +1 -1
  4. package/dist/bundle.min.js +5 -5
  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/index.d.ts +1 -0
  31. package/dist/esm/index.js +1 -1
  32. package/dist/esm/isAssurBemlacha.js +2 -2
  33. package/dist/esm/isAssurBemlacha.js.map +1 -1
  34. package/dist/esm/isAveilut.js +1 -1
  35. package/dist/esm/isFastDay.js +1 -1
  36. package/dist/esm/locale.js +1 -1
  37. package/dist/esm/location.js +3 -3
  38. package/dist/esm/location.js.map +1 -1
  39. package/dist/esm/modern.js +1 -1
  40. package/dist/esm/molad.js +1 -1
  41. package/dist/esm/moladBase.js +1 -1
  42. package/dist/esm/moladDate.js +1 -1
  43. package/dist/esm/omer.js +1 -1
  44. package/dist/esm/parshaName.js +1 -1
  45. package/dist/esm/parshaYear.js +1 -1
  46. package/dist/esm/pkgVersion.d.ts +1 -1
  47. package/dist/esm/pkgVersion.js +2 -2
  48. package/dist/esm/pkgVersion.js.map +1 -1
  49. package/dist/esm/reformatTimeStr.js +1 -1
  50. package/dist/esm/sedra.js +2 -2
  51. package/dist/esm/sedra.js.map +1 -1
  52. package/dist/esm/sefira.json.js +1 -1
  53. package/dist/esm/staticHolidays.js +1 -1
  54. package/dist/esm/string.js +1 -1
  55. package/dist/esm/tachanun.js +1 -1
  56. package/dist/esm/zenith.js +1 -1
  57. package/dist/esm/zmanim.js +8 -8
  58. package/dist/esm/zmanim.js.map +1 -1
  59. package/package.json +6 -6
@@ -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;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,GA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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,aAAa,GAAG,IAAI;gBACpB,iBAAiB,GAAG,IAAI;YAC1B;QACF;IACF;SAAO,IAAI,UAAU,EAAE;QACrB,aAAa,GAAG,IAAI;QACpB,IAAI,GAAG,mBAAmB;IAC5B;;IAEA,MAAM,MAAM,GAAG;AACb,UAAE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,CAAC,WAAW,CAAC;QAC1D,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC;AAC5C,QAAA,MAAM,UAAU,GAAG,QAAQ,CAAC,gBAAgB,EAAE;AAC9C,QAAA,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;AACjE,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ;AACxB,QAAA,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,KAAK;IACvB;AACD;AAED;;;;;AAKG;AACG,SAAU,iCAAiC,CAC/C,EAAiB,EACjB,OAAmB,EAAA;AAEnB,IAAA,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE;AACvB,IAAA,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAoB;IAC7C,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC;AAClD,IAAA,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE,YAAY,CAAC;AAC5D,IAAA,MAAM,kBAAkB,GAAG,MAAM,CAAC,cAAc,EAAE;IAClD,IAAI,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC,EAAE;AAC9C,QAAA,OAAO,IAAI;IACb;IACA,OAAO,IAAI,kBAAkB,CAAC,EAAE,EAAE,kBAAkB,EAAE,QAAQ,CAAC;AACjE;;"}
@@ -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.14.7, distributed under GPLv2 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.14.7, 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.14.7, 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,KAAK,SAAS,OAAO,IAAI,KAAK,SAAS,CAAC,EAAE;AACnD,QAAA,MAAM,IAAI,SAAS,CAAC,oCAAoC,CAAC;IAC3D;IACA,IAAI,MAAM,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,EAAE;AAC9C,QAAA,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AG,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 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,QA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ACZ;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.14.7, 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.14.7, 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.14.7, 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.14.7, 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.14.7, 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';
@@ -17,6 +17,7 @@ export { type MoladBase, calculateMolad } from './moladBase.js';
17
17
  export { getMoladAsDate } from './moladDate.js';
18
18
  export { Molad, MoladEvent } from './molad.js';
19
19
  export { KiddushLevanaEvent } from './KiddushLevanaEvent.js';
20
+ export type { KiddushLevanaAdjustment } from './KiddushLevanaEvent.js';
20
21
  export { OmerEvent, type OmerLang } from './omer.js';
21
22
  export { type TachanunResult, tachanun } from './tachanun.js';
22
23
  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.14.7, 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.14.7, 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;AAE5E;AAEA;;;;;;;AAOG;AACH,SAAS,qBAAqB,CAAC,GAAW,EAAE,MAAe,EAAA;AACzD,IAAA,OAAO,GAAG,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC3D;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,EAAE,EAAE,CAAC;AAClD,IAAA,MAAM,KAAK,G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ha.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();\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;AAE5E;AAEA;;;;;;;AAOG;AACH,SAAS,qBAAqB,CAAC,GAAW,EAAE,MAAe,EAAA;AACzD,IAAA,OAAO,GAAG,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC3D;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BG;SACa,eAAe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AO,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.14.7, 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.14.7, 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.14.7, 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.14.7, 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) {
@@ -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: Readonly<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};\n\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 */\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) || countryCode === 'IL';\n this.cc = countryCode;\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 override 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,GAAqC;AACxD,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;CACtB;AAED,MAAM,eAAe,GAAG,IAAI,QAAQ,CAA8B;AAChE,IAAA,OAAO,EAAE,GAAG;AACb,CAAA,CAAC;AAEF;;;AAGG;AACH,SAAS,YAAY,CAAC,IAAY,EAAA;IAChC,MAAM,GAAG,GAAG,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC;AACrC,IAAA,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AAU,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: Readonly<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};\n\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 */\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 (Number.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 (Number.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) || countryCode === 'IL';\n this.cc = countryCode;\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 override 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,GAAqC;AACxD,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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BAAA,KAAK,CAAC;AACJ,oBAAA,OAAO,eAAe;;QAI5B;AACA,QAAA,IAAI,GAAG,KAAK,KAAK,EAAE;YACjB,OAAO,eAAe,CAAC,MAAM,CAAC,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,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.14.7, 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 { flags } from './event.js';
4
4
  import { HolidayEvent } from './HolidayEvent.js';
package/dist/esm/molad.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.14.7, distributed under GPLv2 or later 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,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.14.7, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { HDate, isLeapYear } from '@hebcal/hdate';
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.14.7, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import 'temporal-polyfill/global';
3
3
  import QuickLRU from 'quick-lru';
4
4
 
package/dist/esm/omer.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.14.7, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { Locale, gematriya } from '@hebcal/hdate';
3
3
  import { Event, flags } from './event.js';
4
4
  import './locale.js';
@@ -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.14.7, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import './locale.js';
3
3
  import { smartApostrophe } from './string.js';
4
4
  import { Locale } from '@hebcal/hdate';
@@ -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.14.7, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { HDate, months } from '@hebcal/hdate';
3
3
  import { ParshaEvent } from './ParshaEvent.js';
4
4
  import { getSedra } from './sedra.js';
@@ -1,2 +1,2 @@
1
1
  /** DO NOT EDIT THIS AUTO-GENERATED FILE! */
2
- export declare const version = "6.14.6";
2
+ export declare const version = "6.14.7";
@@ -1,6 +1,6 @@
1
- /*! @hebcal/core v6.14.6, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.14.7, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  /** DO NOT EDIT THIS AUTO-GENERATED FILE! */
3
- const version = '6.14.6';
3
+ const version = '6.14.7';
4
4
 
5
5
  export { version };
6
6
  //# sourceMappingURL=pkgVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pkgVersion.js","sources":["../../../src/pkgVersion.ts"],"sourcesContent":["/** DO NOT EDIT THIS AUTO-GENERATED FILE! */\nexport const version = '6.14.6';\n"],"names":[],"mappings":";AAAA;AACO,MAAM,OAAO,GAAG;;"}
1
+ {"version":3,"file":"pkgVersion.js","sources":["../../../src/pkgVersion.ts"],"sourcesContent":["/** DO NOT EDIT THIS AUTO-GENERATED FILE! */\nexport const version = '6.14.7';\n"],"names":[],"mappings":";AAAA;AACO,MAAM,OAAO,GAAG;;"}
@@ -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.14.7, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  /** Countries that conventionally use a 12-hour clock */
3
3
  const hour12cc = new Set([
4
4
  'US',
package/dist/esm/sedra.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.14.7, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { HDate, months } from '@hebcal/hdate';
3
3
  import QuickLRU from 'quick-lru';
4
4
  import './locale.js';
@@ -463,7 +463,7 @@ const parshiot = [
463
463
  */
464
464
  function toAbsInYear(hd, rh, year) {
465
465
  const abs = typeof hd === 'number' ? hd : HDate.isHDate(hd) ? hd.abs() : NaN;
466
- if (isNaN(abs)) {
466
+ if (Number.isNaN(abs)) {
467
467
  throw new TypeError(`Bad date argument: ${hd}`);
468
468
  }
469
469
  if (abs < rh) {