@hebcal/core 6.16.1 → 6.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/bundle.js +530 -381
  2. package/dist/bundle.js.map +1 -1
  3. package/dist/bundle.min.js +7 -7
  4. package/dist/bundle.min.js.map +1 -1
  5. package/dist/esm/DailyLearning.js +1 -1
  6. package/dist/esm/HebrewDateEvent.js +1 -1
  7. package/dist/esm/HolidayEvent.js +1 -1
  8. package/dist/esm/KiddushLevanaEvent.js +3 -4
  9. package/dist/esm/KiddushLevanaEvent.js.map +1 -1
  10. package/dist/esm/MevarchimChodeshEvent.js +3 -3
  11. package/dist/esm/MevarchimChodeshEvent.js.map +1 -1
  12. package/dist/esm/ParshaEvent.js +1 -1
  13. package/dist/esm/TimedEvent.js +1 -1
  14. package/dist/esm/YomKippurKatanEvent.js +1 -1
  15. package/dist/esm/ashkenazi.po.js +1 -1
  16. package/dist/esm/calendar.d.ts +6 -0
  17. package/dist/esm/calendar.js +84 -11
  18. package/dist/esm/calendar.js.map +1 -1
  19. package/dist/esm/candles.js +4 -2
  20. package/dist/esm/candles.js.map +1 -1
  21. package/dist/esm/cities.json.js +1 -1
  22. package/dist/esm/event.js +7 -3
  23. package/dist/esm/event.js.map +1 -1
  24. package/dist/esm/getStartAndEnd.js +2 -2
  25. package/dist/esm/getStartAndEnd.js.map +1 -1
  26. package/dist/esm/hallel.js +3 -3
  27. package/dist/esm/hallel.js.map +1 -1
  28. package/dist/esm/he-x-NoNikud.po.js +1 -1
  29. package/dist/esm/he.po.js +1 -1
  30. package/dist/esm/hebcal.js +3 -6
  31. package/dist/esm/hebcal.js.map +1 -1
  32. package/dist/esm/holidays.d.ts +17 -0
  33. package/dist/esm/holidays.js +91 -34
  34. package/dist/esm/holidays.js.map +1 -1
  35. package/dist/esm/horizon.js +1 -1
  36. package/dist/esm/index.d.ts +1 -0
  37. package/dist/esm/index.js +2 -1
  38. package/dist/esm/index.js.map +1 -1
  39. package/dist/esm/isAssurBemlacha.js +7 -23
  40. package/dist/esm/isAssurBemlacha.js.map +1 -1
  41. package/dist/esm/isAveilut.js +1 -1
  42. package/dist/esm/isFastDay.js +1 -1
  43. package/dist/esm/isYomTov.d.ts +21 -0
  44. package/dist/esm/isYomTov.js +46 -0
  45. package/dist/esm/isYomTov.js.map +1 -0
  46. package/dist/esm/locale.js +1 -1
  47. package/dist/esm/location.js +3 -3
  48. package/dist/esm/location.js.map +1 -1
  49. package/dist/esm/modern.js +1 -1
  50. package/dist/esm/molad.js +3 -3
  51. package/dist/esm/molad.js.map +1 -1
  52. package/dist/esm/moladBase.js +1 -1
  53. package/dist/esm/moladDate.js +1 -1
  54. package/dist/esm/omer.js +1 -1
  55. package/dist/esm/parshaName.js +1 -1
  56. package/dist/esm/parshaYear.js +3 -3
  57. package/dist/esm/parshaYear.js.map +1 -1
  58. package/dist/esm/pkgVersion.d.ts +1 -1
  59. package/dist/esm/pkgVersion.js +2 -2
  60. package/dist/esm/pkgVersion.js.map +1 -1
  61. package/dist/esm/reformatTimeStr.js +2 -2
  62. package/dist/esm/reformatTimeStr.js.map +1 -1
  63. package/dist/esm/sedra.js +6 -6
  64. package/dist/esm/sedra.js.map +1 -1
  65. package/dist/esm/sefira.json.js +1 -1
  66. package/dist/esm/staticHolidays.js +1 -1
  67. package/dist/esm/string.js +1 -1
  68. package/dist/esm/tachanun.js +8 -8
  69. package/dist/esm/tachanun.js.map +1 -1
  70. package/dist/esm/zenith.js +1 -1
  71. package/dist/esm/zmanim.js +4 -4
  72. package/dist/esm/zmanim.js.map +1 -1
  73. package/package.json +8 -8
package/dist/bundle.js CHANGED
@@ -1,9 +1,9 @@
1
- /*! @hebcal/core v6.16.1, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.17.0, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  var hebcal = (function (exports) {
3
3
  'use strict';
4
4
 
5
5
  /** DO NOT EDIT THIS AUTO-GENERATED FILE! */
6
- const version = '6.16.1';
6
+ const version = '6.17.0';
7
7
 
8
8
  /*! @hebcal/hdate v0.23.1, distributed under GPLv2 or later https://www.gnu.org/licenses/gpl-2.0.txt */
9
9
  /**
@@ -2568,10 +2568,14 @@ const flags = {
2568
2568
  };
2569
2569
  const flagEntries = Object.entries(flags);
2570
2570
  function flagBit(name) {
2571
- if (!Object.hasOwn(flags, name)) {
2571
+ // No Object.prototype property is a number, so this rejects 'toString'
2572
+ // and friends as well as Object.hasOwn() would, but is cheaper in the
2573
+ // hasFlag() calls on calendar()'s hot path.
2574
+ const bit = flags[name];
2575
+ if (typeof bit !== 'number') {
2572
2576
  throw new RangeError(`Unknown flag name: ${String(name)}`);
2573
2577
  }
2574
- return flags[name];
2578
+ return bit;
2575
2579
  }
2576
2580
  const flagToCategory = [
2577
2581
  [flags.MAJOR_FAST, 'holiday', 'major', 'fast'],
@@ -3252,10 +3256,8 @@ const bigNanoInHour = /*@__PURE__*/ BigInt(nanoInHour);
3252
3256
 
3253
3257
  const bigNanoInUtcDay = /*@__PURE__*/ BigInt(nanoInUtcDay);
3254
3258
 
3255
- function divideBigNanoToExactNumber(bigNano, divisorNano) {
3256
- const days = Number(bigNano / bigNanoInUtcDay);
3257
- const timeNano = Number(bigNano % bigNanoInUtcDay);
3258
- return days * (nanoInUtcDay / divisorNano) + (Math.trunc(timeNano / divisorNano) + timeNano % divisorNano / divisorNano);
3259
+ function divideNanoToNumber(numerator, denominator) {
3260
+ return Number((numerator << 256n) / denominator) / 2 ** 256;
3259
3261
  }
3260
3262
 
3261
3263
  const timeFieldNamesAsc = /*@__PURE__*/ unitNamesAsc.slice(0, 6);
@@ -3542,7 +3544,7 @@ function constrainIsoDateFields(isoDate, overflow) {
3542
3544
  }
3543
3545
 
3544
3546
  function computeCalendarDateFields(calendar, isoDate) {
3545
- return calendar ? calendar.de(isoDate) : isoDate;
3547
+ return calendar ? calendar.ae(isoDate) : isoDate;
3546
3548
  }
3547
3549
 
3548
3550
  function computeCalendarMonthCodeParts(calendar, year, month) {
@@ -3554,7 +3556,7 @@ function computeCalendarEraFields(calendar, isoDate) {
3554
3556
  }
3555
3557
 
3556
3558
  function computeCalendarIsoFieldsFromParts(calendar, year, month, day) {
3557
- return calendar ? calendar.fe(year, month, day) : computeIsoFieldsFromParts(year, month, day);
3559
+ return calendar ? calendar.de(year, month, day) : computeIsoFieldsFromParts(year, month, day);
3558
3560
  }
3559
3561
 
3560
3562
  function computeCalendarMonthsInYearForYear(calendar, year) {
@@ -3573,7 +3575,7 @@ function computeCalendarMonthCode(calendar, isoDate) {
3573
3575
 
3574
3576
  function computeCalendarInLeapYear(calendar, isoDate) {
3575
3577
  const {year: year} = computeCalendarDateFields(calendar, isoDate);
3576
- return calendar ? calendar.q(year) : computeIsoInLeapYear(year);
3578
+ return calendar ? calendar.p(year) : computeIsoInLeapYear(year);
3577
3579
  }
3578
3580
 
3579
3581
  function computeCalendarMonthsInYear(calendar, isoDate) {
@@ -3895,34 +3897,32 @@ function roundWithMode(num, roundingMode) {
3895
3897
  }
3896
3898
 
3897
3899
  function totalRelativeUnit(wholeValue, sign, endEpochNano, moveValueToEpochNano) {
3898
- const unitWindow = clampRelativeUnitValue(wholeValue, sign, moveValueToEpochNano, endEpochNano);
3899
- return interpolateRelativeUnitWindow(unitWindow, Number(endEpochNano - unitWindow.N) / Number(unitWindow.te - unitWindow.N));
3900
+ const {me: startValue, _: epochNano0, ee: epochNano1} = clampRelativeUnitValue(wholeValue, sign, moveValueToEpochNano, endEpochNano);
3901
+ const windowNano = epochNano1 - epochNano0;
3902
+ return windowNano ? divideNanoToNumber(BigInt(startValue) * windowNano + BigInt(sign) * (endEpochNano - epochNano0), windowNano) : startValue;
3900
3903
  }
3901
3904
 
3902
3905
  function roundRelativeUnitWindow(unitWindow, endEpochNano, roundingInc, roundingMode) {
3903
- return roundNumberToInc(interpolateRelativeUnitWindow(unitWindow, computeEpochNanoFrac(endEpochNano, unitWindow.N, unitWindow.te)), roundingInc, roundingMode);
3906
+ const fraction = computeEpochNanoFrac(endEpochNano, unitWindow._, unitWindow.ee);
3907
+ return roundNumberToInc(unitWindow.me + fraction * (unitWindow.qe - unitWindow.me), roundingInc, roundingMode);
3904
3908
  }
3905
3909
 
3906
3910
  function clampRelativeUnitValue(startValue, valueDelta, moveValueToEpochNano, epochNanoProgress) {
3907
3911
  let unitWindow = computeRelativeUnitWindow(startValue, valueDelta, moveValueToEpochNano);
3908
- return ((epochNanoProgress, epochNano0, epochNano1, sign) => sign > 0 ? epochNano0 <= epochNanoProgress && epochNanoProgress <= epochNano1 : epochNano1 <= epochNanoProgress && epochNanoProgress <= epochNano0)(epochNanoProgress, unitWindow.N, unitWindow.te, Math.sign(valueDelta)) || (unitWindow = computeRelativeUnitWindow(startValue + valueDelta, valueDelta, moveValueToEpochNano)),
3912
+ return ((epochNanoProgress, epochNano0, epochNano1, sign) => sign > 0 ? epochNano0 <= epochNanoProgress && epochNanoProgress <= epochNano1 : epochNano1 <= epochNanoProgress && epochNanoProgress <= epochNano0)(epochNanoProgress, unitWindow._, unitWindow.ee, Math.sign(valueDelta)) || (unitWindow = computeRelativeUnitWindow(startValue + valueDelta, valueDelta, moveValueToEpochNano)),
3909
3913
  unitWindow;
3910
3914
  }
3911
3915
 
3912
3916
  function computeRelativeUnitWindow(startValue, valueDelta, moveValueToEpochNano) {
3913
3917
  const endValue = startValue + valueDelta;
3914
3918
  return {
3915
- ve: startValue,
3916
- pe: endValue,
3917
- N: moveValueToEpochNano(startValue),
3918
- te: moveValueToEpochNano(endValue)
3919
+ me: startValue,
3920
+ qe: endValue,
3921
+ _: moveValueToEpochNano(startValue),
3922
+ ee: moveValueToEpochNano(endValue)
3919
3923
  };
3920
3924
  }
3921
3925
 
3922
- function interpolateRelativeUnitWindow(unitWindow, fraction) {
3923
- return unitWindow.ve + fraction * (unitWindow.pe - unitWindow.ve);
3924
- }
3925
-
3926
3926
  function computeEpochNanoFrac(epochNanoProgress, epochNano0, epochNano1) {
3927
3927
  const denomBig = epochNano1 - epochNano0;
3928
3928
  const numeratorBig = epochNanoProgress - epochNano0;
@@ -3975,7 +3975,7 @@ function roundZonedEpochSlotsToUnit(slots, smallestUnit, roundingInc, roundingMo
3975
3975
 
3976
3976
  function computeZonedHoursInDay(slots) {
3977
3977
  const [epochNano0, epochNano1] = computeZonedDayEpochInterval(slots);
3978
- return divideBigNanoToExactNumber(epochNano1 - epochNano0, nanoInHour);
3978
+ return Number(epochNano1 - epochNano0) / nanoInHour;
3979
3979
  }
3980
3980
 
3981
3981
  function computeZonedStartOfDay(slots) {
@@ -4008,6 +4008,14 @@ function roundRelativeDuration(durationFields, endEpochNano, largestUnit, smalle
4008
4008
  roundedDurationFields;
4009
4009
  }
4010
4010
 
4011
+ function roundDayTimeDuration(durationFields, largestUnit, smallestUnit, roundingInc, roundingMode) {
4012
+ const roundedBigNano = roundBigNanoToInc(durationDayTimeToBigNano(durationFields), computeBigNanoInc(smallestUnit, roundingInc), roundingMode);
4013
+ return {
4014
+ ...durationFieldDefaults,
4015
+ ...nanoToDurationDayTimeFields(roundedBigNano, largestUnit)
4016
+ };
4017
+ }
4018
+
4011
4019
  function roundDayTimeDurationByInc(durationFields, nanoInc, roundingMode) {
4012
4020
  const maxUnit = Math.max(Math.min(getMaxDurationUnit(durationFields), 6), 3);
4013
4021
  return nanoToDurationDayTimeFields(roundBigNanoToInc(durationDayTimeToBigNano(durationFields), BigInt(nanoInc), roundingMode), maxUnit);
@@ -4057,7 +4065,7 @@ function nudgeRelativeDuration(sign, durationFields, endEpochNano, _largestUnit,
4057
4065
  const nudgeWindow = clampRelativeUnitValue(truncedVal, roundingInc * sign, value => (baseDurationFields[smallestUnitFieldName] = value,
4058
4066
  moveRelativeMarkerToEpochNano(relativeOps, baseDurationFields)), endEpochNano);
4059
4067
  const roundedVal = roundRelativeUnitWindow(nudgeWindow, endEpochNano, roundingInc, roundingMode);
4060
- return baseDurationFields[smallestUnitFieldName] = roundedVal, [ baseDurationFields, roundedVal === nudgeWindow.pe ? nudgeWindow.te : nudgeWindow.N, roundedVal !== truncedVal ];
4068
+ return baseDurationFields[smallestUnitFieldName] = roundedVal, [ baseDurationFields, roundedVal === nudgeWindow.qe ? nudgeWindow.ee : nudgeWindow._, roundedVal !== truncedVal ];
4061
4069
  }
4062
4070
 
4063
4071
  function nudgeZonedTimeDuration(sign, durationFields, _endEpochNano, _largestUnit, smallestUnit, roundingInc, roundingMode, relativeOps) {
@@ -4068,8 +4076,8 @@ function nudgeZonedTimeDuration(sign, durationFields, _endEpochNano, _largestUni
4068
4076
  ...durationFields,
4069
4077
  ...durationTimeFieldDefaults
4070
4078
  };
4071
- const dayEpochNano0 = relativeOps.X(dateDurationFields);
4072
- const dayEpochNano1 = relativeOps.X({
4079
+ const dayEpochNano0 = relativeOps.V(dateDurationFields);
4080
+ const dayEpochNano1 = relativeOps.V({
4073
4081
  ...dateDurationFields,
4074
4082
  days: dateDurationFields.days + sign
4075
4083
  });
@@ -4161,7 +4169,7 @@ function getMatchingInstantFor(timeZone, isoDateTime, offsetNano, offsetDisambig
4161
4169
  if (hasZ || void 0 !== offsetNano && 1 === offsetDisambig) {
4162
4170
  return isoDateTimeAndOffsetToEpochNano(isoDateTime, offsetNano || 0);
4163
4171
  }
4164
- const possibleEpochNanos = timeZone.O(isoDateTime);
4172
+ const possibleEpochNanos = timeZone.N(isoDateTime);
4165
4173
  if (void 0 !== offsetNano && 3 !== offsetDisambig) {
4166
4174
  checkIsoDateInBounds(isoDateTime, 0);
4167
4175
  const matchingEpochNano = ((possibleEpochNanos, isoDateTime, offsetNano, fuzzy) => {
@@ -4182,7 +4190,7 @@ function getMatchingInstantFor(timeZone, isoDateTime, offsetNano, offsetDisambig
4182
4190
  return getSingleInstantFor(timeZone, isoDateTime, epochDisambig, possibleEpochNanos);
4183
4191
  }
4184
4192
 
4185
- function getSingleInstantFor(timeZone, isoDateTime, disambig = 0, possibleEpochNanos = timeZone.O(isoDateTime)) {
4193
+ function getSingleInstantFor(timeZone, isoDateTime, disambig = 0, possibleEpochNanos = timeZone.N(isoDateTime)) {
4186
4194
  if (1 === possibleEpochNanos.length) {
4187
4195
  return possibleEpochNanos[0];
4188
4196
  }
@@ -4196,11 +4204,11 @@ function getSingleInstantFor(timeZone, isoDateTime, disambig = 0, possibleEpochN
4196
4204
  gapNano))(timeZone.B(zonedEpochNano + bigNanoInUtcDay) - startOffsetNano);
4197
4205
  })(timeZone, zonedEpochNano);
4198
4206
  const shiftedIsoDateTime = epochNanoToIsoDateTime(zonedEpochNano + BigInt(gapNano * (2 === disambig ? -1 : 1)));
4199
- return (possibleEpochNanos = timeZone.O(shiftedIsoDateTime))[2 === disambig ? 0 : possibleEpochNanos.length - 1];
4207
+ return (possibleEpochNanos = timeZone.N(shiftedIsoDateTime))[2 === disambig ? 0 : possibleEpochNanos.length - 1];
4200
4208
  }
4201
4209
 
4202
4210
  function getStartOfDayInstantFor(timeZone, isoDateTime) {
4203
- const possibleEpochNanos = timeZone.O(isoDateTime);
4211
+ const possibleEpochNanos = timeZone.N(isoDateTime);
4204
4212
  if (possibleEpochNanos.length) {
4205
4213
  return possibleEpochNanos[0];
4206
4214
  }
@@ -4209,7 +4217,8 @@ function getStartOfDayInstantFor(timeZone, isoDateTime) {
4209
4217
  }
4210
4218
 
4211
4219
  function moveYearMonth(calendar, isoDate, durationSlots, overflow = 0) {
4212
- computeDurationSign(durationSlots) && clampEntity("unit", getMaxDurationUnit(durationSlots), 8, 9, 1, durationFieldNamesAsc);
4220
+ const subMonthUnit = getMaxDurationUnit(durationSlots, 7);
4221
+ durationSlots[durationFieldNamesAsc[subMonthUnit]] && clampEntity("unit", subMonthUnit, 8, 9, 1, durationFieldNamesAsc);
4213
4222
  const first = checkIsoDateInBounds(moveToStartOfMonth(calendar, isoDate));
4214
4223
  return moveToStartOfMonth(calendar, moveDate(calendar, first, durationSlots, overflow));
4215
4224
  }
@@ -4276,8 +4285,7 @@ function moveDateByCalendarUnits(calendar, isoDate, years, months, overflow) {
4276
4285
  let {year: year, month: month, day: day} = dateParts;
4277
4286
  if (years) {
4278
4287
  const [monthCodeNumber, isLeapMonth] = computeCalendarMonthCodeParts(calendar, year, month);
4279
- year += years, month = resolveMonthInMovedYear(calendar, monthCodeNumber, isLeapMonth, calendar ? calendar.p(year) : void 0, overflow),
4280
- month = clampEntity("month", month, 1, computeCalendarMonthsInYearForYear(calendar, year), overflow);
4288
+ year += years, month = clampEntity("month", resolveMonthInMovedYear(calendar, year, monthCodeNumber, isLeapMonth, overflow), 1, computeCalendarMonthsInYearForYear(calendar, year), overflow);
4281
4289
  }
4282
4290
  if (months) {
4283
4291
  const yearMonthParts = addCalendarMonths(calendar, year, month, months);
@@ -4288,10 +4296,11 @@ function moveDateByCalendarUnits(calendar, isoDate, years, months, overflow) {
4288
4296
  }
4289
4297
 
4290
4298
  function addCalendarMonths(calendar, year, month, monthDelta) {
4291
- return calendar ? calendar.ae(year, month, monthDelta) : addIsoMonths(year, month, monthDelta);
4299
+ return calendar ? calendar.ne(year, month, monthDelta) : addIsoMonths(year, month, monthDelta);
4292
4300
  }
4293
4301
 
4294
- function resolveMonthInMovedYear(calendar, monthCodeNumber, isLeapMonth, targetLeapMonth, overflow) {
4302
+ function resolveMonthInMovedYear(calendar, year, monthCodeNumber, isLeapMonth, overflow) {
4303
+ const targetLeapMonth = calendar ? calendar.q(year) : void 0;
4295
4304
  if (isLeapMonth) {
4296
4305
  const leapMonthMeta = calendar ? calendar.l : void 0;
4297
4306
  if (void 0 !== targetLeapMonth && (leapMonthMeta < 0 || targetLeapMonth === monthCodeNumber + 1)) {
@@ -4320,12 +4329,15 @@ function moveDateByDays(isoDate, days) {
4320
4329
  }
4321
4330
 
4322
4331
  function getCommonCalendar(a, b) {
4323
- return getCalendarSlotId(a) !== getCalendarSlotId(b) && throwRangeError("Mismatching Calendars"),
4324
- a;
4332
+ return checkCalendarIdsMatch(getCalendarSlotId(a), getCalendarSlotId(b)), a;
4333
+ }
4334
+
4335
+ function checkCalendarIdsMatch(calendarId0, calendarId1) {
4336
+ calendarId0 !== calendarId1 && throwRangeError(((calendarId0, calendarId1) => `Mismatching calendars: ${calendarId0} and ${calendarId1}`)(calendarId0, calendarId1));
4325
4337
  }
4326
4338
 
4327
4339
  function getCommonTimeZone(a, b) {
4328
- return a.m !== b.m && throwRangeError("Mismatching TimeZones"),
4340
+ return a.m !== b.m && throwRangeError(`Mismatching time zones: ${a.id} and ${b.id}`),
4329
4341
  a;
4330
4342
  }
4331
4343
 
@@ -4357,8 +4369,8 @@ function diffDateTimesRounded(calendar, startIsoDateTime, endIsoDateTime, larges
4357
4369
  let durationFields;
4358
4370
  return durationFields = diffDateTimesBig(calendar, startIsoDateTime, endIsoDateTime, sign, largestUnit),
4359
4371
  durationFields = roundRelativeDuration(durationFields, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode, ((calendar, origin) => ({
4360
- ne: isoDateTimeToEpochNano(origin),
4361
- X: duration => isoDateTimeToEpochNano(combineDateAndTime(moveDate(calendar, origin, duration), origin))
4372
+ re: isoDateTimeToEpochNano(origin),
4373
+ V: duration => isoDateTimeToEpochNano(combineDateAndTime(moveDate(calendar, origin, duration), origin))
4362
4374
  }))(calendar, startIsoDateTime)), durationFields;
4363
4375
  })(calendar, startIsoDateTime, endIsoDateTime, largestUnit, smallestUnit, roundingInc, roundingMode);
4364
4376
  }
@@ -4474,61 +4486,30 @@ function diffCalendarDates(calendar, startIsoDate, endIsoDate, largestUnit) {
4474
4486
  };
4475
4487
  })(7 === largestUnit, startIsoDate, endIsoDate);
4476
4488
  }
4477
- const yearMonthDayStart = computeCalendarDateFields(calendar, startIsoDate);
4478
- const yearMonthDayEnd = computeCalendarDateFields(calendar, endIsoDate);
4479
- if (8 === largestUnit) {
4480
- const {year: year0, month: month0, day: day0} = yearMonthDayStart;
4481
- const {year: year1, month: month1, day: day1} = yearMonthDayEnd;
4482
- const sign = Math.sign(compareNumbers(year1, year0) || compareNumbers(month1, month0) || countIsoDays(startIsoDate, endIsoDate));
4483
- let months = 0;
4484
- let days = 0;
4485
- if (sign) {
4486
- months = calendar ? calendar.ee(year0, month0, year1, month1) : diffIsoMonthSlots(year0, month0, year1, month1);
4487
- let anchorIsoDate = moveDateByCalendarUnits(calendar, startIsoDate, 0, months, 0);
4488
- sign * compareNumbers(day0, day1) > 0 && (months -= sign, anchorIsoDate = moveDateByCalendarUnits(calendar, startIsoDate, 0, months, 0)),
4489
- days = countIsoDays(anchorIsoDate, endIsoDate);
4490
- }
4491
- return {
4492
- ...durationFieldDefaults,
4493
- months: months,
4494
- days: days
4495
- };
4496
- }
4497
- const {year: year0, month: month0, day: day0} = yearMonthDayStart;
4498
- let {year: year1, month: month1, day: day1} = yearMonthDayEnd;
4499
- let yearDiff = year1 - year0;
4500
- let monthDiff = month1 - month0;
4501
- let dayDiff = day1 - day0;
4502
- if (yearDiff || monthDiff) {
4503
- const sign = Math.sign(yearDiff || monthDiff);
4504
- let daysInMonth1 = computeCalendarDaysInMonthForYearMonth(calendar, year1, month1);
4505
- let dayCorrect = 0;
4506
- if (Math.sign(day1 - day0) === -sign) {
4507
- const origDaysInMonth1 = daysInMonth1;
4508
- const yearMonthParts = addCalendarMonths(calendar, year1, month1, -sign);
4509
- (({year: year1, month: month1} = yearMonthParts)), yearDiff = year1 - year0, monthDiff = month1 - month0,
4510
- daysInMonth1 = computeCalendarDaysInMonthForYearMonth(calendar, year1, month1),
4511
- dayCorrect = sign < 0 ? -origDaysInMonth1 : daysInMonth1;
4512
- }
4513
- if (dayDiff = day1 - Math.min(day0, daysInMonth1) + dayCorrect, yearDiff) {
4489
+ const sign = compareIsoDates(endIsoDate, startIsoDate);
4490
+ let years = 0;
4491
+ let months = 0;
4492
+ let days = 0;
4493
+ if (sign) {
4494
+ const {year: year0, month: month0, day: day0} = computeCalendarDateFields(calendar, startIsoDate);
4495
+ const {year: year1, month: month1, day: day1} = computeCalendarDateFields(calendar, endIsoDate);
4496
+ const dayOrder = compareNumbers(day0, day1);
4497
+ let movedMonth = month0;
4498
+ if (9 === largestUnit && (years = year1 - year0)) {
4514
4499
  const [monthCodeNumber0, isLeapMonth0] = computeCalendarMonthCodeParts(calendar, year0, month0);
4515
4500
  const [monthCodeNumber1, isLeapMonth1] = computeCalendarMonthCodeParts(calendar, year1, month1);
4516
- const leapMonthMeta = calendar ? calendar.l : void 0;
4517
- if (monthDiff = void 0 !== leapMonthMeta && isLeapMonth0 && !isLeapMonth1 && (leapMonthMeta < 0 ? sign > 0 && monthCodeNumber1 === -leapMonthMeta : sign < 0 && monthCodeNumber1 === monthCodeNumber0) ? 0 : monthCodeNumber1 - monthCodeNumber0 || Number(isLeapMonth1) - Number(isLeapMonth0),
4518
- Math.sign(monthDiff) === -sign) {
4519
- const monthCorrect = sign < 0 && -computeCalendarMonthsInYearForYear(calendar, year1);
4520
- year1 -= sign, yearDiff = year1 - year0, monthDiff = month1 - resolveMonthInMovedYear(calendar, monthCodeNumber0, isLeapMonth0, calendar ? calendar.p(year1) : void 0, 0) + (monthCorrect || computeCalendarMonthsInYearForYear(calendar, year1));
4521
- } else if (calendar) {
4522
- const month0Projected = resolveMonthInMovedYear(calendar, monthCodeNumber0, isLeapMonth0, calendar.p(year1), 0);
4523
- monthDiff = calendar.ee(year1, month0Projected, year1, month1);
4524
- }
4501
+ movedMonth = resolveMonthInMovedYear(calendar, year1, monthCodeNumber0, isLeapMonth0, 0),
4502
+ (sign * (compareNumbers(2 * monthCodeNumber0 + Number(isLeapMonth0), 2 * monthCodeNumber1 + Number(isLeapMonth1)) || dayOrder) > 0 || sign * (compareNumbers(movedMonth, month1) || dayOrder) > 0) && (years -= sign,
4503
+ movedMonth = resolveMonthInMovedYear(calendar, year0 + years, monthCodeNumber0, isLeapMonth0, 0));
4525
4504
  }
4505
+ months = (calendar ? calendar.he(year0 + years, movedMonth, year1, month1) : diffIsoMonthSlots(year0 + years, movedMonth, year1, month1)) - (sign * dayOrder > 0 ? sign : 0),
4506
+ days = countIsoDays(years || months ? moveDateByCalendarUnits(calendar, startIsoDate, years, months, 0) : startIsoDate, endIsoDate);
4526
4507
  }
4527
4508
  return {
4528
4509
  ...durationFieldDefaults,
4529
- years: yearDiff,
4530
- months: monthDiff,
4531
- days: dayDiff
4510
+ years: years,
4511
+ months: months,
4512
+ days: days
4532
4513
  };
4533
4514
  }
4534
4515
 
@@ -4553,26 +4534,30 @@ function spanRelativeDuration(relativeToSlots, durationFields, largestUnit) {
4553
4534
  })(relativeToSlots, durationFields, largestUnit);
4554
4535
  }
4555
4536
 
4556
- function moveRelativeEndpointToEpochNano(relativeToSlots, durationFields) {
4557
- return isZonedEpochSlots(relativeToSlots) ? moveZonedEpochSlots(relativeToSlots, durationFields).epochNanoseconds : isoDateTimeToEpochNano(moveDateTime(relativeToSlots.calendar, combineDateAndTime(relativeToSlots, timeFieldDefaults), durationFields));
4537
+ function countDateDurationDays(relativeToSlots, durationFields) {
4538
+ return durationFields.days + isoDateToEpochDays(moveDate(relativeToSlots.calendar, relativeToSlots, {
4539
+ ...durationFields,
4540
+ ...durationTimeFieldDefaults,
4541
+ days: 0
4542
+ })) - isoDateToEpochDays(relativeToSlots);
4558
4543
  }
4559
4544
 
4560
4545
  function moveRelativeMarkerToEpochNano(relativeOps, dateDuration) {
4561
- return durationHasDateParts(dateDuration) ? relativeOps.X(dateDuration) : relativeOps.ne;
4546
+ return durationHasDateParts(dateDuration) ? relativeOps.V(dateDuration) : relativeOps.re;
4562
4547
  }
4563
4548
 
4564
4549
  function createZonedRelativeOps(calendar, timeZone, slots) {
4565
4550
  const origin = zonedEpochSlotsToIso(slots);
4566
4551
  return {
4567
- ne: slots.epochNanoseconds,
4568
- X: duration => getSingleInstantFor(timeZone, combineDateAndTime(moveDate(calendar, origin, duration), origin))
4552
+ re: slots.epochNanoseconds,
4553
+ V: duration => getSingleInstantFor(timeZone, combineDateAndTime(moveDate(calendar, origin, duration), origin))
4569
4554
  };
4570
4555
  }
4571
4556
 
4572
4557
  function createDateRelativeOps(calendar, origin) {
4573
4558
  return {
4574
- ne: isoDateToEpochNano(origin),
4575
- X: duration => isoDateToEpochNano(moveDate(calendar, origin, duration))
4559
+ re: isoDateToEpochNano(origin),
4560
+ V: duration => isoDateToEpochNano(moveDate(calendar, origin, duration))
4576
4561
  };
4577
4562
  }
4578
4563
 
@@ -4623,21 +4608,15 @@ function roundDuration(refineRelativeTo, slots, options) {
4623
4608
  [ largestUnit, smallestUnit, roundingInc, roundingMode, relativeToInternals ];
4624
4609
  })(options, durationLargestUnit, refineRelativeTo);
4625
4610
  if (!relativeToSlots && Math.max(durationLargestUnit, largestUnit) <= 6) {
4626
- return createDurationSlots(validateDurationFields(((durationFields, largestUnit, smallestUnit, roundingInc, roundingMode) => {
4627
- const roundedBigNano = roundBigNanoToInc(durationDayTimeToBigNano(durationFields), computeBigNanoInc(smallestUnit, roundingInc), roundingMode);
4628
- return {
4629
- ...durationFieldDefaults,
4630
- ...nanoToDurationDayTimeFields(roundedBigNano, largestUnit)
4631
- };
4632
- })(slots, largestUnit, smallestUnit, roundingInc, roundingMode)));
4611
+ return createDurationSlots(validateDurationFields(roundDayTimeDuration(slots, largestUnit, smallestUnit, roundingInc, roundingMode)));
4633
4612
  }
4634
4613
  relativeToSlots || throwRangeError("Missing relativeTo");
4635
4614
  const isZoned = isZonedEpochSlots(relativeToSlots);
4636
4615
  if (!slots.sign && (!isZoned || largestUnit < 6)) {
4637
4616
  return slots;
4638
4617
  }
4639
- const [balancedDuration, endEpochNano, relativeOps] = spanRelativeDuration(relativeToSlots, slots, largestUnit);
4640
- return createDurationSlots(roundRelativeDuration(balancedDuration, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode, relativeOps, isZoned));
4618
+ const [balancedDuration, endEpochNano, relativeOps] = spanRelativeDuration(relativeToSlots, slots, Math.max(largestUnit, 3));
4619
+ return createDurationSlots(largestUnit < 3 ? roundDayTimeDuration(balancedDuration, largestUnit, smallestUnit, roundingInc, roundingMode) : roundRelativeDuration(balancedDuration, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode, relativeOps, isZoned));
4641
4620
  }
4642
4621
 
4643
4622
  function absDuration(slots) {
@@ -4670,8 +4649,12 @@ function validateDurationFields(fields) {
4670
4649
  for (const calendarUnit of durationCalendarFieldNamesAsc) {
4671
4650
  validateDurationCalendarUnit(calendarUnit, fields[calendarUnit]);
4672
4651
  }
4652
+ return validateDurationDayTime(fields), fields;
4653
+ }
4654
+
4655
+ function validateDurationDayTime(fields) {
4673
4656
  const bigNano = durationDayTimeToBigNano(fields);
4674
- return validateDurationTimeUnit(Number(bigNano / bigNanoInSec)), fields;
4657
+ return validateDurationTimeUnit(Number(bigNano / bigNanoInSec)), bigNano;
4675
4658
  }
4676
4659
 
4677
4660
  function validateDurationCalendarUnit(unit, value) {
@@ -4712,8 +4695,7 @@ function durationHasDateParts(fields) {
4712
4695
  return Boolean(computeDurationSign(fields, durationDateFieldNamesAsc));
4713
4696
  }
4714
4697
 
4715
- function getMaxDurationUnit(fields) {
4716
- let unit = 9;
4698
+ function getMaxDurationUnit(fields, unit = 9) {
4717
4699
  for (;unit > 0 && !fields[durationFieldNamesAsc[unit]]; unit--) {}
4718
4700
  return unit;
4719
4701
  }
@@ -4725,8 +4707,24 @@ function compareZonedEpochSlots(zonedEpochSlots0, zonedEpochSlots1) {
4725
4707
  function compareDurations(refineRelativeTo, durationSlots0, durationSlots1, options) {
4726
4708
  const relativeToSlots = refineRelativeTo(normalizeOptions(options).relativeTo);
4727
4709
  const maxUnit = Math.max(getMaxDurationUnit(durationSlots0), getMaxDurationUnit(durationSlots1));
4728
- return allPropsEqual(durationFieldNamesAsc, durationSlots0, durationSlots1) ? 0 : isUniformUnit(maxUnit, relativeToSlots && isZonedEpochSlots(relativeToSlots)) ? compareBigInts(durationDayTimeToBigNano(durationSlots0), durationDayTimeToBigNano(durationSlots1)) : (relativeToSlots || throwRangeError("Missing relativeTo"),
4729
- compareBigInts(moveRelativeEndpointToEpochNano(relativeToSlots, durationSlots0), moveRelativeEndpointToEpochNano(relativeToSlots, durationSlots1)));
4710
+ if (allPropsEqual(durationFieldNamesAsc, durationSlots0, durationSlots1)) {
4711
+ return 0;
4712
+ }
4713
+ if (isUniformUnit(maxUnit, relativeToSlots && isZonedEpochSlots(relativeToSlots))) {
4714
+ return compareBigInts(durationDayTimeToBigNano(durationSlots0), durationDayTimeToBigNano(durationSlots1));
4715
+ }
4716
+ if (relativeToSlots || throwRangeError("Missing relativeTo"), isZonedEpochSlots(relativeToSlots)) {
4717
+ return compareBigInts(moveZonedEpochSlots(relativeToSlots, durationSlots0).epochNanoseconds, moveZonedEpochSlots(relativeToSlots, durationSlots1).epochNanoseconds);
4718
+ }
4719
+ const days0 = countDateDurationDays(relativeToSlots, durationSlots0);
4720
+ const days1 = countDateDurationDays(relativeToSlots, durationSlots1);
4721
+ return compareBigInts(validateDurationDayTime({
4722
+ ...durationSlots0,
4723
+ days: days0
4724
+ }), validateDurationDayTime({
4725
+ ...durationSlots1,
4726
+ days: days1
4727
+ }));
4730
4728
  }
4731
4729
 
4732
4730
  function compareIsoDateTimeFields(isoDateTime0, isoDateTime1) {
@@ -4788,7 +4786,7 @@ function resolveCalendarYear(fields, calendar) {
4788
4786
  const normalizedEra = normalizeEraName(era);
4789
4787
  const eraOrigin = eraOrigins[normalizedEra];
4790
4788
  void 0 === eraOrigin && throwRangeError((era => `Invalid era: ${era}`)(era));
4791
- const yearByEra = exoticCalendar?._ ? exoticCalendar._(eraYear, normalizedEra, eraOrigin) : eraYearToYear(eraYear, eraOrigin);
4789
+ const yearByEra = exoticCalendar?.$ ? exoticCalendar.$(eraYear, normalizedEra, eraOrigin) : eraYearToYear(eraYear, eraOrigin);
4792
4790
  void 0 !== year && year !== yearByEra && throwRangeError("Mismatching year/eraYear"),
4793
4791
  year = yearByEra;
4794
4792
  } else {
@@ -4801,7 +4799,7 @@ function resolveCalendarMonth(fields, calendar, year, monthCodeParts, overflow)
4801
4799
  let {month: month, monthCode: monthCode} = fields;
4802
4800
  if (void 0 !== monthCode) {
4803
4801
  const monthByCode = ((calendar, monthCode, year, overflow, monthCodeParts = parseMonthCode(monthCode)) => {
4804
- const leapMonth = calendar ? calendar.p(year) : void 0;
4802
+ const leapMonth = calendar ? calendar.q(year) : void 0;
4805
4803
  const [monthCodeNumber, wantsLeapMonth] = monthCodeParts;
4806
4804
  let month = monthCodeNumberToMonth(monthCodeNumber, wantsLeapMonth, leapMonth);
4807
4805
  if (wantsLeapMonth) {
@@ -4946,11 +4944,11 @@ function createMonthDayFromRefinedFields(fields, calendar, year, monthCodeParts,
4946
4944
  day = resolveCalendarDay(fields, calendar, yearMaybe, month, overflow), [monthCodeNumber, isLeapMonth] = computeCalendarMonthCodeParts(calendar, yearMaybe, month);
4947
4945
  } else {
4948
4946
  void 0 === fields.monthCode && throwTypeError("Missing month/monthCode"), [monthCodeNumber, isLeapMonth] = monthCodeParts;
4949
- const referenceYear = calendar ? calendar.re : 1972;
4947
+ const referenceYear = calendar ? calendar.te : 1972;
4950
4948
  if (void 0 !== referenceYear) {
4951
4949
  day = resolveCalendarDay(fields, calendar, referenceYear, resolveCalendarMonth(fields, calendar, referenceYear, monthCodeParts, overflow), overflow);
4952
4950
  } else {
4953
- const constrainedDay = 0 === overflow && calendar ? calendar.ge?.(monthCodeNumber, isLeapMonth, fields.day) : void 0;
4951
+ const constrainedDay = 0 === overflow && calendar ? calendar.fe?.(monthCodeNumber, isLeapMonth, fields.day) : void 0;
4954
4952
  day = void 0 !== constrainedDay ? constrainedDay : fields.day;
4955
4953
  }
4956
4954
  }
@@ -4963,8 +4961,8 @@ function createYearMonthFromCalendarParts(calendar, year, month) {
4963
4961
 
4964
4962
  function createMonthDayFromMonthCodeParts(calendar, monthCodeNumber, isLeapMonthArg, day, requestedDay, overflow) {
4965
4963
  let isLeapMonth = isLeapMonthArg;
4966
- isLeapMonth && ((calendar && calendar.U?.[monthCodeNumber]) ?? 1 / 0) < requestedDay && (1 === overflow && throwRangeError(invalidLeapMonth),
4967
- isLeapMonth = 0, day = constrainToRange(requestedDay, 1, (calendar && calendar.R) ?? 1 / 0));
4964
+ isLeapMonth && ((calendar && calendar.R?.[monthCodeNumber]) ?? 1 / 0) < requestedDay && (1 === overflow && throwRangeError(invalidLeapMonth),
4965
+ isLeapMonth = 0, day = constrainToRange(requestedDay, 1, (calendar && calendar.O) ?? 1 / 0));
4968
4966
  let res = calendar ? calendar.u(monthCodeNumber, Boolean(isLeapMonth), day) : computeIsoYearMonthFieldsForMonthDay(monthCodeNumber, Boolean(isLeapMonth));
4969
4967
  for (;!res && 0 === overflow && day > 1; ) {
4970
4968
  day--, res = calendar ? calendar.u(monthCodeNumber, Boolean(isLeapMonth), day) : computeIsoYearMonthFieldsForMonthDay(monthCodeNumber, Boolean(isLeapMonth));
@@ -5214,7 +5212,7 @@ const resolveTimeZoneRecord = /*@__PURE__*/ memoize(rawId => {
5214
5212
  if (void 0 !== offsetNano) {
5215
5213
  return {
5216
5214
  id: formatOffsetNano(offsetNano),
5217
- Z: offsetNano,
5215
+ X: offsetNano,
5218
5216
  m: offsetNano
5219
5217
  };
5220
5218
  }
@@ -5238,9 +5236,9 @@ const queryNamedTimeZoneRecord = /*@__PURE__*/ memoize(normId => {
5238
5236
  m: normId
5239
5237
  };
5240
5238
  }
5241
- const format = (upperNormId = normId.toUpperCase(), new RawDateTimeFormat("en-u-hc-h23", {
5239
+ const format = (normId => new RawDateTimeFormat("en-u-hc-h23", {
5242
5240
  calendar: "iso8601",
5243
- timeZone: upperNormId,
5241
+ timeZone: normId,
5244
5242
  era: "short",
5245
5243
  year: "numeric",
5246
5244
  month: "numeric",
@@ -5248,8 +5246,7 @@ const queryNamedTimeZoneRecord = /*@__PURE__*/ memoize(normId => {
5248
5246
  hour: "numeric",
5249
5247
  minute: "numeric",
5250
5248
  second: "numeric"
5251
- }));
5252
- var upperNormId;
5249
+ }))(normId);
5253
5250
  return {
5254
5251
  kind: "named",
5255
5252
  id: normId,
@@ -5263,24 +5260,24 @@ function queryTimeZone(rawTimeZoneId) {
5263
5260
  return queryTimeZoneRecord(record.id, record);
5264
5261
  }
5265
5262
 
5266
- const queryTimeZoneRecord = /*@__PURE__*/ memoize((normTimeZoneId, record) => "named" === record.kind ? new IntlTimeZone(normTimeZoneId, record.m, record.format) : new FixedTimeZone(normTimeZoneId, record.m, "fixed" === record.kind ? record.Z : 0));
5263
+ const queryTimeZoneRecord = /*@__PURE__*/ memoize((normTimeZoneId, record) => "named" === record.kind ? new IntlTimeZone(normTimeZoneId, record.m, record.format) : new FixedTimeZone(normTimeZoneId, record.m, "fixed" === record.kind ? record.X : 0));
5267
5264
 
5268
5265
  class FixedTimeZone {
5269
5266
  constructor(id, compareKey, offsetNano) {
5270
- this.id = id, this.m = compareKey, this.Z = offsetNano;
5267
+ this.id = id, this.m = compareKey, this.X = offsetNano;
5271
5268
  }
5272
5269
  B() {
5273
- return this.Z;
5270
+ return this.X;
5274
5271
  }
5275
- O(isoDateTime) {
5276
- return [ isoDateTimeAndOffsetToEpochNano(isoDateTime, this.Z) ];
5272
+ N(isoDateTime) {
5273
+ return [ isoDateTimeAndOffsetToEpochNano(isoDateTime, this.X) ];
5277
5274
  }
5278
5275
  C() {}
5279
5276
  }
5280
5277
 
5281
5278
  class IntlTimeZone {
5282
5279
  constructor(id, compareKey, format) {
5283
- this.id = id, this.m = compareKey, this.me = ((computeOffsetSec, periodDays) => {
5280
+ this.id = id, this.m = compareKey, this.oe = ((computeOffsetSec, periodDays) => {
5284
5281
  const getSample = memoize(computeOffsetSec);
5285
5282
  const getSplit = memoize(createSplitTuple);
5286
5283
  const periodSec = 86400 * periodDays;
@@ -5362,16 +5359,16 @@ class IntlTimeZone {
5362
5359
  })(id));
5363
5360
  }
5364
5361
  B(epochNano) {
5365
- return this.me.ze((epochNano => epochNanoToSecMod(epochNano)[0])(epochNano)) * nanoInSec;
5362
+ return this.oe.ze((epochNano => epochNanoToSecMod(epochNano)[0])(epochNano)) * nanoInSec;
5366
5363
  }
5367
- O(isoDateTime) {
5364
+ N(isoDateTime) {
5368
5365
  const zonedEpochSec = 86400 * isoDateToEpochDays(isoDateTime) + timeFieldsToSec(isoDateTime);
5369
5366
  const subsecNano = timeFieldsToSubsecNano(isoDateTime);
5370
- return this.me.Ae(zonedEpochSec).map(epochSec => checkEpochNanoInBounds(BigInt(epochSec) * bigNanoInSec + BigInt(subsecNano)));
5367
+ return this.oe.Ae(zonedEpochSec).map(epochSec => checkEpochNanoInBounds(BigInt(epochSec) * bigNanoInSec + BigInt(subsecNano)));
5371
5368
  }
5372
5369
  C(epochNano, direction) {
5373
5370
  const [epochSec, subsecNano] = epochNanoToSecMod(epochNano);
5374
- const resEpochSec = this.me.C(epochSec + (direction > 0 || subsecNano ? 1 : 0), direction);
5371
+ const resEpochSec = this.oe.C(epochSec + (direction > 0 || subsecNano ? 1 : 0), direction);
5375
5372
  if (void 0 !== resEpochSec) {
5376
5373
  return BigInt(resEpochSec) * bigNanoInSec;
5377
5374
  }
@@ -5513,7 +5510,7 @@ function parsePlainMonthDay(s, resolveCalendar) {
5513
5510
 
5514
5511
  function parsePlainTime(s) {
5515
5512
  const organized = parseDateTimeLike(s = requireString(s)) || parseTimeOnly(s);
5516
- return (!organized || !organized.qe || organized.I || parseYearMonthOnly(s) || parseMonthDayOnly(s)) && throwFailedParse(s),
5513
+ return (!organized || !organized.se || organized.I || parseYearMonthOnly(s) || parseMonthDayOnly(s)) && throwFailedParse(s),
5517
5514
  createTimeSlots(organized);
5518
5515
  }
5519
5516
 
@@ -5552,10 +5549,10 @@ function parsePlainDateLike(s) {
5552
5549
  function finalizeZonedDateTime(organized, resolveCalendar, options) {
5553
5550
  const timeZone = queryTimeZone(resolveTimeZoneId(organized.timeZoneId));
5554
5551
  let epochNano;
5555
- if (organized.qe) {
5552
+ if (organized.se) {
5556
5553
  const offsetNano = organized.offset ? parseOffsetNano(organized.offset) : void 0;
5557
5554
  const [, offsetDisambig, epochDisambig] = refineZonedFieldOptions(options);
5558
- epochNano = getMatchingInstantFor(timeZone, organized, offsetNano, offsetDisambig, epochDisambig, !(timeZone.Z || void 0 === organized.offset || (offset = organized.offset,
5555
+ epochNano = getMatchingInstantFor(timeZone, organized, offsetNano, offsetDisambig, epochDisambig, !(timeZone.X || void 0 === organized.offset || (offset = organized.offset,
5559
5556
  offset.length > 6)), organized.I);
5560
5557
  } else {
5561
5558
  refineZonedFieldOptions(options), epochNano = getStartOfDayInstantFor(timeZone, organized);
@@ -5600,7 +5597,7 @@ function parseDateTimeLike(s) {
5600
5597
  minute: parseInt0(parts[7]),
5601
5598
  second: Math.min(parseInt0(parts[8]), 59),
5602
5599
  ...organizeAnnotationParts(parts[18], parts[19]),
5603
- qe: !!parts[5],
5600
+ se: !!parts[5],
5604
5601
  I: !!parts[10],
5605
5602
  offset: parts[11]
5606
5603
  }))(parts);
@@ -5792,7 +5789,7 @@ function totalDuration(refineRelativeTo, slots, options) {
5792
5789
  if (relativeToSlots || throwRangeError("Missing relativeTo"), !slots.sign && (!isZoned || totalUnit < 6)) {
5793
5790
  return 0;
5794
5791
  }
5795
- const [balancedDuration, endEpochNano, relativeOps] = spanRelativeDuration(relativeToSlots, slots, totalUnit);
5792
+ const [balancedDuration, endEpochNano, relativeOps] = spanRelativeDuration(relativeToSlots, slots, Math.max(totalUnit, 3));
5796
5793
  return isUniformUnit(totalUnit, isZoned) ? totalDayTimeDuration(balancedDuration, totalUnit) : ((durationFields, endEpochNano, totalUnit, relativeOps) => {
5797
5794
  const fieldName = durationFieldNamesAsc[totalUnit];
5798
5795
  const baseDurationFields = clearDurationFields(totalUnit, durationFields);
@@ -5802,7 +5799,7 @@ function totalDuration(refineRelativeTo, slots, options) {
5802
5799
  }
5803
5800
 
5804
5801
  function totalDayTimeDuration(durationFields, totalUnit) {
5805
- return divideBigNanoToExactNumber(durationDayTimeToBigNano(durationFields), unitNanoMap[totalUnit]);
5802
+ return divideNanoToNumber(durationDayTimeToBigNano(durationFields), BigInt(unitNanoMap[totalUnit]));
5806
5803
  }
5807
5804
 
5808
5805
  function instantToZonedDateTime(instantSlots, timeZone, calendar) {
@@ -5883,8 +5880,7 @@ function applyZonedFormatTimeZone(options, timeZoneId) {
5883
5880
  }
5884
5881
 
5885
5882
  function checkResolvedCalendarCompatible(format, slots, strictCalendarCheck) {
5886
- const resolvedCalendarId = format.resolvedOptions().calendar;
5887
- !strictCalendarCheck && slots.calendar === isoCalendarImpl || getCalendarSlotId(slots.calendar) === resolvedCalendarId || throwRangeError("Mismatching Calendars");
5883
+ (strictCalendarCheck || slots.calendar !== isoCalendarImpl) && checkCalendarIdsMatch(getCalendarSlotId(slots.calendar), format.resolvedOptions().calendar);
5888
5884
  }
5889
5885
 
5890
5886
  function createOptionsTransformer(shapeFieldNames, invalidShapeFieldNames, ignoredFieldNames, defaultShapeFields, dateStyleReplacementFields) {
@@ -6046,7 +6042,7 @@ function createDateTimeFormatShell(createArgsProvider, transformOptions = identi
6046
6042
  const resolvedOptions = baseFormat.resolvedOptions();
6047
6043
  const copiedOptions = pluckProps(observedOptionNames, resolvedOptions);
6048
6044
  internalsMap.set(this, {
6049
- $: createArgsProvider({
6045
+ Z: createArgsProvider({
6050
6046
  t: baseFormat,
6051
6047
  Ce: resolvedOptions.locale,
6052
6048
  F: copiedOptions,
@@ -6058,12 +6054,12 @@ function createDateTimeFormatShell(createArgsProvider, transformOptions = identi
6058
6054
  get format() {
6059
6055
  const internals = getInternals(this);
6060
6056
  return internals.we || (internals.we = record => {
6061
- const [format, ...rest] = internals.$.A(record);
6057
+ const [format, ...rest] = internals.Z.A(record);
6062
6058
  return format.format(...rest);
6063
6059
  });
6064
6060
  }
6065
6061
  formatToParts(record) {
6066
- const {$: argsProvider} = getInternals(this);
6062
+ const {Z: argsProvider} = getInternals(this);
6067
6063
  const [format, ...rest] = argsProvider.A(record);
6068
6064
  return format.formatToParts(...rest);
6069
6065
  }
@@ -6077,12 +6073,12 @@ function createDateTimeFormatShell(createArgsProvider, transformOptions = identi
6077
6073
  }
6078
6074
  RawDateTimeFormat.prototype.formatRange && Object.defineProperties(prototype, createPropDescriptors({
6079
6075
  formatRange(record0, record1) {
6080
- const {$: argsProvider} = getInternals(this);
6076
+ const {Z: argsProvider} = getInternals(this);
6081
6077
  const [format, epochMilli0, epochMilli1] = argsProvider.v(record0, record1);
6082
6078
  return format.formatRange(epochMilli0, epochMilli1);
6083
6079
  },
6084
6080
  formatRangeToParts(record0, record1) {
6085
- const {$: argsProvider} = getInternals(this);
6081
+ const {Z: argsProvider} = getInternals(this);
6086
6082
  const [format, epochMilli0, epochMilli1] = argsProvider.v(record0, record1);
6087
6083
  return format.formatRangeToParts(epochMilli0, epochMilli1);
6088
6084
  }
@@ -9161,11 +9157,11 @@ class Location extends GeoLocation {
9161
9157
  * @param [elevation] - in meters (default `0`)
9162
9158
  */
9163
9159
  constructor(latitude, longitude, il, tzid, cityName, countryCode, geoid, elevation) {
9164
- const lat = typeof latitude === 'number' ? latitude : parseFloat(latitude);
9160
+ const lat = typeof latitude === 'number' ? latitude : Number.parseFloat(latitude);
9165
9161
  if (Number.isNaN(lat) || lat < -90 || lat > 90) {
9166
9162
  throw new RangeError(`Latitude ${latitude} out of range [-90,90]`);
9167
9163
  }
9168
- const long = typeof longitude === 'number' ? longitude : parseFloat(longitude);
9164
+ const long = typeof longitude === 'number' ? longitude : Number.parseFloat(longitude);
9169
9165
  if (Number.isNaN(long) || long < -180 || long > 180) {
9170
9166
  throw new RangeError(`Longitude ${longitude} out of range [-180,180]`);
9171
9167
  }
@@ -9439,7 +9435,7 @@ function reformatTimeStr(timeStr, suffix, options) {
9439
9435
  return timeStr;
9440
9436
  }
9441
9437
  const hm = timeStr.split(':');
9442
- let hour = parseInt(hm[0], 10);
9438
+ let hour = Number.parseInt(hm[0], 10);
9443
9439
  if (hour < 12 && suffix) {
9444
9440
  suffix = suffix.replace('p', 'a').replace('P', 'A');
9445
9441
  if (hour === 0) {
@@ -9699,7 +9695,7 @@ class Molad {
9699
9695
  * for example 'Elul' or 'Cheshvan'.
9700
9696
  */
9701
9697
  getMonthName() {
9702
- return HDate.getMonthName(this.month, this.year);
9698
+ return getMonthName(this.month, this.year);
9703
9699
  }
9704
9700
  /**
9705
9701
  * @returns Day of Week (0=Sunday, 6=Saturday)
@@ -10748,7 +10744,7 @@ class Zmanim {
10748
10744
  // Evaluate the low end first so polar day/night (NaN time) is caught at once.
10749
10745
  const tLo = timeAt(aLo);
10750
10746
  if (Number.isNaN(tLo)) {
10751
- return millisToDate(NaN);
10747
+ return millisToDate(Number.NaN);
10752
10748
  }
10753
10749
  if (g(aLo) >= 0) {
10754
10750
  return millisToDate(tLo);
@@ -10756,7 +10752,7 @@ class Zmanim {
10756
10752
  let prevA = aLo;
10757
10753
  for (let a = aLo + step; a <= aHi + 1e-9; a += step) {
10758
10754
  if (Number.isNaN(timeAt(a))) {
10759
- return millisToDate(NaN);
10755
+ return millisToDate(Number.NaN);
10760
10756
  }
10761
10757
  if (g(a) >= 0) {
10762
10758
  // Crossing in (prevA, a): bisect the altitude bracket to 0.0005°.
@@ -10775,7 +10771,7 @@ class Zmanim {
10775
10771
  }
10776
10772
  prevA = a;
10777
10773
  }
10778
- return millisToDate(NaN);
10774
+ return millisToDate(Number.NaN);
10779
10775
  }
10780
10776
  /**
10781
10777
  * Rabbeinu Tam holds that bein hashmashos is a specific time
@@ -11318,7 +11314,153 @@ class Zmanim {
11318
11314
  }
11319
11315
  }
11320
11316
 
11321
- const { NISAN: NISAN$4, IYYAR: IYYAR$2, SIVAN: SIVAN$2, AV: AV$2, ELUL: ELUL$1, TISHREI: TISHREI$2, SHVAT, ADAR_II: ADAR_II$1 } = months;
11317
+ /**
11318
+ * Returns `true` if the given Hebrew date is a _Yom Tov_ with a _melacha_
11319
+ * (work) prohibition: Rosh Hashana, Yom Kippur, the first and last days of
11320
+ * Sukkot/Pesach, Shmini Atzeret, Simchat Torah (Diaspora) and Shavuot.
11321
+ *
11322
+ * These are exactly the days that carry the `CHAG` flag. Shabbat is not
11323
+ * considered, and neither is Chol HaMoed.
11324
+ *
11325
+ * The result is computed directly from the Hebrew month and day,
11326
+ * without generating holiday events.
11327
+ * @example
11328
+ * import {isYomTov, HDate, months} from '@hebcal/core';
11329
+ * isYomTov(new HDate(10, months.TISHREI, 5785), false); // true (Yom Kippur)
11330
+ * isYomTov(new HDate(16, months.NISAN, 5784), false); // true (Pesach II)
11331
+ * isYomTov(new HDate(16, months.NISAN, 5784), true); // false (Chol HaMoed)
11332
+ * isYomTov(new HDate(25, months.KISLEV, 5784), false); // false (Chanukah)
11333
+ * @param hdate Hebrew date to test
11334
+ * @param il use the Israeli holiday schedule
11335
+ */
11336
+ function isYomTov(hdate, il) {
11337
+ const dd = hdate.getDate();
11338
+ switch (hdate.getMonth()) {
11339
+ case months.TISHREI:
11340
+ return (dd === 1 || // Rosh Hashana I
11341
+ dd === 2 || // Rosh Hashana II
11342
+ dd === 10 || // Yom Kippur
11343
+ dd === 15 || // Sukkot I
11344
+ dd === 22 || // Shmini Atzeret
11345
+ (!il && (dd === 16 || dd === 23)) // Sukkot II, Simchat Torah
11346
+ );
11347
+ case months.NISAN:
11348
+ // Pesach I and VII, plus Pesach II and VIII in the Diaspora
11349
+ return dd === 15 || dd === 21 || (!il && (dd === 16 || dd === 22));
11350
+ case months.SIVAN:
11351
+ // Shavuot, plus a second day in the Diaspora
11352
+ return dd === 6 || (!il && dd === 7);
11353
+ default:
11354
+ return false;
11355
+ }
11356
+ }
11357
+
11358
+ /**
11359
+ * Returns `true` if the given moment (date + time) falls within a period
11360
+ * when *melacha* (work) is prohibited — i.e. Shabbat or a Yom Tov.
11361
+ *
11362
+ * The Shabbat/Yom Tov window is taken to begin at sunset (shkiah) on the
11363
+ * preceding day (Erev Shabbat / Erev Yom Tov / Yom Tov sheni) and to end
11364
+ * at *tzais* (nightfall) on the day itself. *Tzais* is calculated using a
11365
+ * solar depression of 8.5° for simplicity; consult a halachic authority
11366
+ * for more stringent opinions.
11367
+ *
11368
+ * `useElevation` controls whether the location's elevation is taken into
11369
+ * account when computing sunset (it has no effect on the degree-based
11370
+ * tzais calculation). The Israel/Diaspora schedule comes from
11371
+ * `location.getIsrael()`.
11372
+ *
11373
+ * Throws if sunset cannot be calculated for the given location
11374
+ * (e.g. polar regions).
11375
+ * @example
11376
+ * import {isAssurBemlacha, Location} from '@hebcal/core';
11377
+ * const loc = Location.lookup('Jerusalem')!;
11378
+ * // Friday after sunset:
11379
+ * isAssurBemlacha(new Date('2024-04-26T18:00:00Z'), loc, false); // true
11380
+ * @param currentTime the moment to test (with hour/minute)
11381
+ * @param location geographic location (also supplies Israel/Diaspora flag and tzid)
11382
+ * @param useElevation include elevation when computing sunset
11383
+ * @return `true` if *melacha* is prohibited, `false` if it is not
11384
+ */
11385
+ function isAssurBemlacha(currentTime, location, useElevation) {
11386
+ // Determine the calendar date in the location's timezone, not the
11387
+ // timezone of the computer running this code. Otherwise the day-of-week,
11388
+ // Hebrew date and sunset/tzais times would depend on the machine's
11389
+ // local timezone, giving different (incorrect) results near midnight.
11390
+ const isoDate = getPseudoISO(location.getTzid(), currentTime);
11391
+ const year = Number.parseInt(isoDate.substring(0, 4), 10);
11392
+ const month = Number.parseInt(isoDate.substring(5, 7), 10);
11393
+ const day = Number.parseInt(isoDate.substring(8, 10), 10);
11394
+ const hd = new HDate(new Date(year, month - 1, day));
11395
+ const zmanim = new Zmanim(location, hd, useElevation);
11396
+ // erev shabbos, YT or YT sheni and after shkiah
11397
+ const sunset = zmanim.sunset();
11398
+ const sunsetMillis = sunset.getTime();
11399
+ if (Number.isNaN(sunsetMillis)) {
11400
+ throw new Error('Could not determine sunset');
11401
+ }
11402
+ // erev shabbos, YT or YT sheni and after shkiah
11403
+ const il = location.getIsrael();
11404
+ const currentMillis = currentTime.getTime();
11405
+ const dow = hd.getDay();
11406
+ if (currentMillis >= sunsetMillis && (dow === 5 || isYomTov(hd.next(), il))) {
11407
+ return true;
11408
+ }
11409
+ // is shabbos or YT and it is before tzais
11410
+ if (dow === 6 || isYomTov(hd, il)) {
11411
+ const tzais = zmanim.tzeit();
11412
+ const tzaisMillis = tzais.getTime();
11413
+ return currentMillis <= tzaisMillis;
11414
+ }
11415
+ return false;
11416
+ }
11417
+
11418
+ const { NISAN: NISAN$4, SIVAN: SIVAN$2, TAMUZ: TAMUZ$1, AV: AV$2 } = months;
11419
+ const SAT$2 = 6;
11420
+ function getHDate(date) {
11421
+ return HDate.isHDate(date) ? date : new HDate(date);
11422
+ }
11423
+ function isSefiratHaOmer(hd) {
11424
+ const hyear = hd.getFullYear();
11425
+ const beginOmer = new HDate(16, NISAN$4, hyear).abs();
11426
+ const endOmer = new HDate(5, SIVAN$2, hyear).abs();
11427
+ const abs = hd.abs();
11428
+ return abs >= beginOmer && abs <= endOmer;
11429
+ }
11430
+ function isBeinHaMetzarim(hd) {
11431
+ const hyear = hd.getFullYear();
11432
+ const begin = new HDate(17, TAMUZ$1, hyear).abs();
11433
+ const tishaBav = new HDate(9, AV$2, hyear);
11434
+ const end = tishaBav.getDay() === SAT$2 ? new HDate(10, AV$2, hyear).abs() : tishaBav.abs();
11435
+ const abs = hd.abs();
11436
+ return abs >= begin && abs <= end;
11437
+ }
11438
+ /**
11439
+ * Returns `true` if the given date falls within a public period of communal
11440
+ * mourning — specifically:
11441
+ *
11442
+ * - **Sefirat HaOmer**: 16 Nisan through 5 Sivan (the 49 days of the Omer).
11443
+ * - **Bein HaMetzarim** ("between the straits"): 17 Tammuz through 9 Av
11444
+ * (10 Av when 9 Av is postponed because it falls on Shabbat).
11445
+ *
11446
+ * This is a broad helper — it does not attempt to model minhag-specific
11447
+ * exceptions within those periods (e.g. Lag BaOmer, Rosh Chodesh Iyar,
11448
+ * the distinction between Sephardic and Ashkenazic customs on which
11449
+ * portion of the Omer is observed as mourning, etc.).
11450
+ * @example
11451
+ * import {isAveilut, HDate, months} from '@hebcal/core';
11452
+ * isAveilut(new HDate(20, months.NISAN, 5784)); // true (Omer)
11453
+ * isAveilut(new HDate(25, months.TAMUZ, 5784)); // true (Three Weeks)
11454
+ * isAveilut(new HDate(15, months.AV, 5784)); // false
11455
+ * @param date Hebrew Date, Gregorian date, or absolute R.D. day number
11456
+ * @return `true` if the date is during a mourning period
11457
+ */
11458
+ function isAveilut(date) {
11459
+ const hd = getHDate(date);
11460
+ return isSefiratHaOmer(hd) || isBeinHaMetzarim(hd);
11461
+ }
11462
+
11463
+ const { NISAN: NISAN$3, IYYAR: IYYAR$2, SIVAN: SIVAN$1, AV: AV$1, ELUL: ELUL$1, TISHREI: TISHREI$2, SHVAT, ADAR_II: ADAR_II$1 } = months;
11322
11464
  const { CHAG: CHAG$1, LIGHT_CANDLES: LIGHT_CANDLES$2, YOM_TOV_ENDS: YOM_TOV_ENDS$1, CHUL_ONLY: CHUL_ONLY$1, IL_ONLY: IL_ONLY$2, LIGHT_CANDLES_TZEIS: LIGHT_CANDLES_TZEIS$3, MAJOR_FAST: MAJOR_FAST$2, MINOR_HOLIDAY: MINOR_HOLIDAY$2, EREV: EREV$2, CHOL_HAMOED: CHOL_HAMOED$1, } = flags;
11323
11465
  /**
11324
11466
  * Transliterated names of holidays, used by `Event.getDesc()`
@@ -11579,82 +11721,82 @@ const staticHolidays = [
11579
11721
  holiday(ADAR_II$1, 14, d.PURIM, MINOR_HOLIDAY$2, { emoji: emojiPurim }),
11580
11722
  holiday(ADAR_II$1, 15, d.SHUSHAN_PURIM, MINOR_HOLIDAY$2, { emoji: emojiPurim }),
11581
11723
  // Pesach Israel
11582
- holiday(NISAN$4, 14, d.EREV_PESACH, IL_ONLY$2 | EREV$2 | LIGHT_CANDLES$2, {
11724
+ holiday(NISAN$3, 14, d.EREV_PESACH, IL_ONLY$2 | EREV$2 | LIGHT_CANDLES$2, {
11583
11725
  emoji: emojiErevPesach,
11584
11726
  }),
11585
- holiday(NISAN$4, 15, d.PESACH_I, IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1, {
11727
+ holiday(NISAN$3, 15, d.PESACH_I, IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1, {
11586
11728
  emoji: emojiPesach,
11587
11729
  }),
11588
- holiday(NISAN$4, 16, d.PESACH_II_CHM, IL_ONLY$2 | CHOL_HAMOED$1, {
11730
+ holiday(NISAN$3, 16, d.PESACH_II_CHM, IL_ONLY$2 | CHOL_HAMOED$1, {
11589
11731
  chmDay: 1,
11590
11732
  emoji: emojiPesach,
11591
11733
  }),
11592
- holiday(NISAN$4, 17, d.PESACH_III_CHM, IL_ONLY$2 | CHOL_HAMOED$1, {
11734
+ holiday(NISAN$3, 17, d.PESACH_III_CHM, IL_ONLY$2 | CHOL_HAMOED$1, {
11593
11735
  chmDay: 2,
11594
11736
  emoji: emojiPesach,
11595
11737
  }),
11596
- holiday(NISAN$4, 18, d.PESACH_IV_CHM, IL_ONLY$2 | CHOL_HAMOED$1, {
11738
+ holiday(NISAN$3, 18, d.PESACH_IV_CHM, IL_ONLY$2 | CHOL_HAMOED$1, {
11597
11739
  chmDay: 3,
11598
11740
  emoji: emojiPesach,
11599
11741
  }),
11600
- holiday(NISAN$4, 19, d.PESACH_V_CHM, IL_ONLY$2 | CHOL_HAMOED$1, {
11742
+ holiday(NISAN$3, 19, d.PESACH_V_CHM, IL_ONLY$2 | CHOL_HAMOED$1, {
11601
11743
  chmDay: 4,
11602
11744
  emoji: emojiPesach,
11603
11745
  }),
11604
- holiday(NISAN$4, 20, d.PESACH_VI_CHM, IL_ONLY$2 | CHOL_HAMOED$1 | LIGHT_CANDLES$2, {
11746
+ holiday(NISAN$3, 20, d.PESACH_VI_CHM, IL_ONLY$2 | CHOL_HAMOED$1 | LIGHT_CANDLES$2, {
11605
11747
  chmDay: 5,
11606
11748
  emoji: emojiPesach,
11607
11749
  }),
11608
- holiday(NISAN$4, 21, d.PESACH_VII, IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1, {
11750
+ holiday(NISAN$3, 21, d.PESACH_VII, IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1, {
11609
11751
  emoji: emojiPesach,
11610
11752
  }),
11611
11753
  // Pesach chutz l'aretz
11612
- holiday(NISAN$4, 14, d.EREV_PESACH, CHUL_ONLY$1 | EREV$2 | LIGHT_CANDLES$2, {
11754
+ holiday(NISAN$3, 14, d.EREV_PESACH, CHUL_ONLY$1 | EREV$2 | LIGHT_CANDLES$2, {
11613
11755
  emoji: emojiErevPesach,
11614
11756
  }),
11615
- holiday(NISAN$4, 15, d.PESACH_I, CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$3, {
11757
+ holiday(NISAN$3, 15, d.PESACH_I, CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$3, {
11616
11758
  emoji: emojiErevPesach,
11617
11759
  }),
11618
- holiday(NISAN$4, 16, d.PESACH_II, CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1, {
11760
+ holiday(NISAN$3, 16, d.PESACH_II, CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1, {
11619
11761
  emoji: emojiPesach,
11620
11762
  }),
11621
- holiday(NISAN$4, 17, d.PESACH_III_CHM, CHUL_ONLY$1 | CHOL_HAMOED$1, {
11763
+ holiday(NISAN$3, 17, d.PESACH_III_CHM, CHUL_ONLY$1 | CHOL_HAMOED$1, {
11622
11764
  chmDay: 1,
11623
11765
  emoji: emojiPesach,
11624
11766
  }),
11625
- holiday(NISAN$4, 18, d.PESACH_IV_CHM, CHUL_ONLY$1 | CHOL_HAMOED$1, {
11767
+ holiday(NISAN$3, 18, d.PESACH_IV_CHM, CHUL_ONLY$1 | CHOL_HAMOED$1, {
11626
11768
  chmDay: 2,
11627
11769
  emoji: emojiPesach,
11628
11770
  }),
11629
- holiday(NISAN$4, 19, d.PESACH_V_CHM, CHUL_ONLY$1 | CHOL_HAMOED$1, {
11771
+ holiday(NISAN$3, 19, d.PESACH_V_CHM, CHUL_ONLY$1 | CHOL_HAMOED$1, {
11630
11772
  chmDay: 3,
11631
11773
  emoji: emojiPesach,
11632
11774
  }),
11633
- holiday(NISAN$4, 20, d.PESACH_VI_CHM, CHUL_ONLY$1 | CHOL_HAMOED$1 | LIGHT_CANDLES$2, {
11775
+ holiday(NISAN$3, 20, d.PESACH_VI_CHM, CHUL_ONLY$1 | CHOL_HAMOED$1 | LIGHT_CANDLES$2, {
11634
11776
  chmDay: 4,
11635
11777
  emoji: emojiPesach,
11636
11778
  }),
11637
- holiday(NISAN$4, 21, d.PESACH_VII, CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$3, {
11779
+ holiday(NISAN$3, 21, d.PESACH_VII, CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$3, {
11638
11780
  emoji: emojiPesach,
11639
11781
  }),
11640
- holiday(NISAN$4, 22, d.PESACH_VIII, CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1, {
11782
+ holiday(NISAN$3, 22, d.PESACH_VIII, CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1, {
11641
11783
  emoji: emojiPesach,
11642
11784
  }),
11643
11785
  holiday(IYYAR$2, 14, d.PESACH_SHENI, MINOR_HOLIDAY$2),
11644
11786
  holiday(IYYAR$2, 18, d.LAG_BAOMER, MINOR_HOLIDAY$2, { emoji: '🔥' }),
11645
- holiday(SIVAN$2, 5, d.EREV_SHAVUOT, EREV$2 | LIGHT_CANDLES$2, {
11787
+ holiday(SIVAN$1, 5, d.EREV_SHAVUOT, EREV$2 | LIGHT_CANDLES$2, {
11646
11788
  emoji: emojiShavuot,
11647
11789
  }),
11648
- holiday(SIVAN$2, 6, d.SHAVUOT, IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1, {
11790
+ holiday(SIVAN$1, 6, d.SHAVUOT, IL_ONLY$2 | CHAG$1 | YOM_TOV_ENDS$1, {
11649
11791
  emoji: emojiShavuot,
11650
11792
  }),
11651
- holiday(SIVAN$2, 6, d.SHAVUOT_I, CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$3, {
11793
+ holiday(SIVAN$1, 6, d.SHAVUOT_I, CHUL_ONLY$1 | CHAG$1 | LIGHT_CANDLES_TZEIS$3, {
11652
11794
  emoji: emojiShavuot,
11653
11795
  }),
11654
- holiday(SIVAN$2, 7, d.SHAVUOT_II, CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1, {
11796
+ holiday(SIVAN$1, 7, d.SHAVUOT_II, CHUL_ONLY$1 | CHAG$1 | YOM_TOV_ENDS$1, {
11655
11797
  emoji: emojiShavuot,
11656
11798
  }),
11657
- holiday(AV$2, 15, d.TU_BAV, MINOR_HOLIDAY$2, { emoji: '❤️' }),
11799
+ holiday(AV$1, 15, d.TU_BAV, MINOR_HOLIDAY$2, { emoji: '❤️' }),
11658
11800
  holiday(ELUL$1, 1, d.ROSH_HASHANA_LABEHEMOT, MINOR_HOLIDAY$2, { emoji: '🐑' }),
11659
11801
  holiday(ELUL$1, 29, d.EREV_ROSH_HASHANA, EREV$2 | LIGHT_CANDLES$2, {
11660
11802
  emoji: emojiRoshHashana,
@@ -11894,7 +12036,7 @@ var Day;
11894
12036
  Day[Day["FRI"] = 5] = "FRI";
11895
12037
  Day[Day["SAT"] = 6] = "SAT";
11896
12038
  })(Day || (Day = {}));
11897
- const { NISAN: NISAN$3, IYYAR: IYYAR$1, CHESHVAN: CHESHVAN$1 } = months;
12039
+ const { NISAN: NISAN$2, IYYAR: IYYAR$1, CHESHVAN: CHESHVAN$1 } = months;
11898
12040
  /**
11899
12041
  * Yom HaShoah first observed in 1951.
11900
12042
  * When the actual date of Yom Hashoah falls on a Friday, the
@@ -11907,12 +12049,12 @@ function dateYomHaShoah(year) {
11907
12049
  if (year < 5711) {
11908
12050
  return null;
11909
12051
  }
11910
- let nisan27dt = new HDate(27, NISAN$3, year);
12052
+ let nisan27dt = new HDate(27, NISAN$2, year);
11911
12053
  if (nisan27dt.getDay() === Day.FRI) {
11912
- nisan27dt = new HDate(26, NISAN$3, year);
12054
+ nisan27dt = new HDate(26, NISAN$2, year);
11913
12055
  }
11914
12056
  else if (nisan27dt.getDay() === Day.SUN) {
11915
- nisan27dt = new HDate(28, NISAN$3, year);
12057
+ nisan27dt = new HDate(28, NISAN$2, year);
11916
12058
  }
11917
12059
  return nisan27dt;
11918
12060
  }
@@ -11925,7 +12067,7 @@ function dateYomHaZikaron(year) {
11925
12067
  return null;
11926
12068
  }
11927
12069
  let day;
11928
- const pesach = new HDate(15, NISAN$3, year);
12070
+ const pesach = new HDate(15, NISAN$2, year);
11929
12071
  const pdow = pesach.getDay();
11930
12072
  if (pdow === Day.SUN) {
11931
12073
  day = 2;
@@ -12007,7 +12149,7 @@ const staticModernHolidays = [
12007
12149
  suppressEmoji: true,
12008
12150
  postpone: 'friSatToThu',
12009
12151
  },
12010
- { firstYear: 5777, mm: NISAN$3, dd: 10, desc: holidayDesc.YOM_HAALIYAH, chul: true },
12152
+ { firstYear: 5777, mm: NISAN$2, dd: 10, desc: holidayDesc.YOM_HAALIYAH, chul: true },
12011
12153
  {
12012
12154
  firstYear: 5777,
12013
12155
  mm: CHESHVAN$1,
@@ -12102,8 +12244,8 @@ const INCOMPLETE = 0;
12102
12244
  const REGULAR = 1;
12103
12245
  const COMPLETE = 2;
12104
12246
  function yearType(hyear) {
12105
- const longC = HDate.longCheshvan(hyear);
12106
- const shortK = HDate.shortKislev(hyear);
12247
+ const longC = longCheshvan(hyear);
12248
+ const shortK = shortKislev(hyear);
12107
12249
  if (longC && !shortK) {
12108
12250
  return COMPLETE;
12109
12251
  }
@@ -12145,7 +12287,7 @@ class Sedra {
12145
12287
  const rhDay = rh0.getDay() + 1;
12146
12288
  // find the first Saturday on or after Rosh Hashana
12147
12289
  this.firstSaturday = HDate.dayOnOrBefore(6, rh + 6);
12148
- const leap = +HDate.isLeapYear(hyear);
12290
+ const leap = +isLeapYear(hyear);
12149
12291
  this.il = Boolean(il);
12150
12292
  const type = yearType(hyear);
12151
12293
  let key = `${leap}${rhDay}${type}`;
@@ -12520,7 +12662,7 @@ const parshiot = [
12520
12662
  * date on or after Rosh Hashana of `year` (whose R.D. day is `rh`)
12521
12663
  */
12522
12664
  function toAbsInYear(hd, rh, year) {
12523
- const abs = typeof hd === 'number' ? hd : HDate.isHDate(hd) ? hd.abs() : NaN;
12665
+ const abs = typeof hd === 'number' ? hd : HDate.isHDate(hd) ? hd.abs() : Number.NaN;
12524
12666
  if (Number.isNaN(abs)) {
12525
12667
  throw new TypeError(`Bad date argument: ${hd}`);
12526
12668
  }
@@ -12889,10 +13031,24 @@ class YomKippurKatanEvent extends HolidayEvent {
12889
13031
  * @param [il] use the Israeli schedule for holidays
12890
13032
  */
12891
13033
  function getHolidaysOnDate(date, il) {
12892
- const hd = HDate.isHDate(date) ? date : new HDate(date);
12893
- const hdStr = hd.toString();
12894
- const yearMap = getHolidaysForYear_(hd.getFullYear());
12895
- const events = yearMap.get(hdStr);
13034
+ let abs;
13035
+ let entry;
13036
+ const last = lastEntry;
13037
+ if (typeof date === 'number' &&
13038
+ last !== undefined &&
13039
+ date >= last.startAbs &&
13040
+ date <= last.endAbs) {
13041
+ // Callers often walk day by day; skip the R.D. → Hebrew date
13042
+ // conversion while the date stays within the most recently used year.
13043
+ abs = date;
13044
+ entry = last;
13045
+ }
13046
+ else {
13047
+ const hd = HDate.isHDate(date) ? date : new HDate(date);
13048
+ abs = hd.abs();
13049
+ entry = getYearEntry(hd.getFullYear());
13050
+ }
13051
+ const events = entry.map.get(abs);
12896
13052
  // if il isn't a boolean return both diaspora + IL for day
12897
13053
  if (il === undefined || events === undefined) {
12898
13054
  return events;
@@ -12904,12 +13060,15 @@ const SUN = 0;
12904
13060
  const TUE = 2;
12905
13061
  const THU = 4;
12906
13062
  const FRI$1 = 5;
12907
- const SAT$2 = 6;
12908
- const { NISAN: NISAN$2, IYYAR, TAMUZ: TAMUZ$1, AV: AV$1, TISHREI: TISHREI$1, CHESHVAN, KISLEV, TEVET, ADAR_I, ADAR_II } = months;
13063
+ const SAT$1 = 6;
13064
+ const { NISAN: NISAN$1, IYYAR, TAMUZ, AV, TISHREI: TISHREI$1, CHESHVAN, KISLEV, TEVET, ADAR_I, ADAR_II } = months;
12909
13065
  const yearCache = new QuickLRU({ maxSize: 120 });
13066
+ /** Most recently used year, so day-by-day callers skip the LRU lookup */
13067
+ let lastEntry;
13068
+ const stringMapCache = new WeakMap();
12910
13069
  function addToMap(map, ...events) {
12911
13070
  for (const ev of events) {
12912
- const key = ev.date.toString();
13071
+ const key = ev.date.abs();
12913
13072
  const arr = map.get(key);
12914
13073
  if (arr !== undefined) {
12915
13074
  arr.push(ev);
@@ -13005,10 +13164,10 @@ function addTishreiHolidays(map, year, RH) {
13005
13164
  const tzomGedaliahDay = RH.getDay() === THU ? 4 : 3;
13006
13165
  addToMap(map, new HolidayEvent(new HDate(tzomGedaliahDay, TISHREI$1, year), holidayDesc.TZOM_GEDALIAH, MINOR_FAST$1),
13007
13166
  // first SAT after RH
13008
- new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$2, 7 + RH.abs())), holidayDesc.SHABBAT_SHUVA, SPECIAL_SHABBAT$1));
13167
+ new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$1, 7 + RH.abs())), holidayDesc.SHABBAT_SHUVA, SPECIAL_SHABBAT$1));
13009
13168
  }
13010
13169
  function addChanukahAndTevet(map, year) {
13011
- const rchTevet = HDate.shortKislev(year)
13170
+ const rchTevet = shortKislev(year)
13012
13171
  ? new HDate(1, TEVET, year)
13013
13172
  : new HDate(30, KISLEV, year);
13014
13173
  addToMap(map, new HolidayEvent(rchTevet, holidayDesc.CHAG_HABANOT, MINOR_HOLIDAY$1), new ChanukahEvent(new HDate(24, KISLEV, year), holidayDesc.CHANUKAH_1_CANDLE, EREV$1 | MINOR_HOLIDAY$1 | CHANUKAH_CANDLES$1, undefined));
@@ -13022,52 +13181,52 @@ function addChanukahAndTevet(map, year) {
13022
13181
  }
13023
13182
  function addPesachSeasonHolidays(map, year, pesach) {
13024
13183
  const pesachAbs = pesach.abs();
13025
- const haChodeshAbs = HDate.dayOnOrBefore(SAT$2, pesachAbs - 14);
13026
- addToMap(map, new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$2, pesachAbs - 43)), holidayDesc.SHABBAT_SHEKALIM, SPECIAL_SHABBAT$1), new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$2, pesachAbs - 30)), holidayDesc.SHABBAT_ZACHOR, SPECIAL_SHABBAT$1), new HolidayEvent(new HDate(pesachAbs - (pesach.getDay() === TUE ? 33 : 31)), holidayDesc.TAANIT_ESTHER, MINOR_FAST$1), new HolidayEvent(new HDate(haChodeshAbs - 7), holidayDesc.SHABBAT_PARAH, SPECIAL_SHABBAT$1), new HolidayEvent(new HDate(haChodeshAbs), holidayDesc.SHABBAT_HACHODESH, SPECIAL_SHABBAT$1), new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$2, pesachAbs - 1)), holidayDesc.SHABBAT_HAGADOL, SPECIAL_SHABBAT$1), new HolidayEvent(
13184
+ const haChodeshAbs = HDate.dayOnOrBefore(SAT$1, pesachAbs - 14);
13185
+ addToMap(map, new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$1, pesachAbs - 43)), holidayDesc.SHABBAT_SHEKALIM, SPECIAL_SHABBAT$1), new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$1, pesachAbs - 30)), holidayDesc.SHABBAT_ZACHOR, SPECIAL_SHABBAT$1), new HolidayEvent(new HDate(pesachAbs - (pesach.getDay() === TUE ? 33 : 31)), holidayDesc.TAANIT_ESTHER, MINOR_FAST$1), new HolidayEvent(new HDate(haChodeshAbs - 7), holidayDesc.SHABBAT_PARAH, SPECIAL_SHABBAT$1), new HolidayEvent(new HDate(haChodeshAbs), holidayDesc.SHABBAT_HACHODESH, SPECIAL_SHABBAT$1), new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$1, pesachAbs - 1)), holidayDesc.SHABBAT_HAGADOL, SPECIAL_SHABBAT$1), new HolidayEvent(
13027
13186
  // if the fast falls on Shabbat, move to Thursday
13028
- pesach.prev().getDay() === SAT$2
13187
+ pesach.prev().getDay() === SAT$1
13029
13188
  ? pesach.onOrBefore(THU)
13030
- : new HDate(14, NISAN$2, year), holidayDesc.TAANIT_BECHOROT, MINOR_FAST$1));
13189
+ : new HDate(14, NISAN$1, year), holidayDesc.TAANIT_BECHOROT, MINOR_FAST$1));
13031
13190
  }
13032
13191
  function addLeilSelichot(map, year) {
13033
- addToMap(map, new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$2, new HDate(1, TISHREI$1, year + 1).abs() - 4)), holidayDesc.LEIL_SELICHOT, MINOR_HOLIDAY$1, { emoji: '🕍' }));
13192
+ addToMap(map, new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$1, new HDate(1, TISHREI$1, year + 1).abs() - 4)), holidayDesc.LEIL_SELICHOT, MINOR_HOLIDAY$1, { emoji: '🕍' }));
13034
13193
  }
13035
13194
  function addPurimVariants(map, year, pesach) {
13036
13195
  if (pesach.getDay() === SUN) {
13037
13196
  addToMap(map, new HolidayEvent(new HDate(16, ADAR_II, year), holidayDesc.PURIM_MESHULASH, MINOR_HOLIDAY$1));
13038
13197
  }
13039
- if (HDate.isLeapYear(year)) {
13198
+ if (isLeapYear(year)) {
13040
13199
  addToMap(map, new HolidayEvent(new HDate(14, ADAR_I, year), holidayDesc.PURIM_KATAN, MINOR_HOLIDAY$1, { emoji: '🎭️' }), new HolidayEvent(new HDate(15, ADAR_I, year), holidayDesc.SHUSHAN_PURIM_KATAN, MINOR_HOLIDAY$1, { emoji: '🎭️' }));
13041
13200
  }
13042
13201
  }
13043
13202
  function addSummerFasts(map, year) {
13044
- let tamuz17 = new HDate(17, TAMUZ$1, year);
13203
+ let tamuz17 = new HDate(17, TAMUZ, year);
13045
13204
  let tamuz17attrs;
13046
- if (tamuz17.getDay() === SAT$2) {
13047
- tamuz17 = new HDate(18, TAMUZ$1, year);
13205
+ if (tamuz17.getDay() === SAT$1) {
13206
+ tamuz17 = new HDate(18, TAMUZ, year);
13048
13207
  tamuz17attrs = { observed: true };
13049
13208
  }
13050
13209
  addToMap(map, new HolidayEvent(tamuz17, holidayDesc.TZOM_TAMMUZ, MINOR_FAST$1, tamuz17attrs));
13051
- let av9dt = new HDate(9, AV$1, year);
13210
+ let av9dt = new HDate(9, AV, year);
13052
13211
  let av9title = holidayDesc.TISHA_BAV;
13053
13212
  let av9attrs;
13054
- if (av9dt.getDay() === SAT$2) {
13213
+ if (av9dt.getDay() === SAT$1) {
13055
13214
  av9dt = av9dt.next();
13056
13215
  av9attrs = { observed: true };
13057
13216
  av9title += ' (observed)';
13058
13217
  }
13059
13218
  const av9abs = av9dt.abs();
13060
- addToMap(map, new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$2, av9abs)), holidayDesc.SHABBAT_CHAZON, SPECIAL_SHABBAT$1), new HolidayEvent(av9dt.prev(), holidayDesc.EREV_TISHA_BAV, EREV$1 | MAJOR_FAST$1, av9attrs), new HolidayEvent(av9dt, av9title, MAJOR_FAST$1, av9attrs), new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$2, av9abs + 7)), holidayDesc.SHABBAT_NACHAMU, SPECIAL_SHABBAT$1));
13219
+ addToMap(map, new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$1, av9abs)), holidayDesc.SHABBAT_CHAZON, SPECIAL_SHABBAT$1), new HolidayEvent(av9dt.prev(), holidayDesc.EREV_TISHA_BAV, EREV$1 | MAJOR_FAST$1, av9attrs), new HolidayEvent(av9dt, av9title, MAJOR_FAST$1, av9attrs), new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$1, av9abs + 7)), holidayDesc.SHABBAT_NACHAMU, SPECIAL_SHABBAT$1));
13061
13220
  }
13062
13221
  function daysInPreviousMonth(month, year) {
13063
- return month === NISAN$2
13064
- ? HDate.daysInMonth(HDate.monthsInYear(year - 1), year - 1)
13065
- : HDate.daysInMonth(month - 1, year);
13222
+ return month === NISAN$1
13223
+ ? daysInMonth(monthsInYear(year - 1), year - 1)
13224
+ : daysInMonth(month - 1, year);
13066
13225
  }
13067
13226
  function addRoshChodesh(map, year) {
13068
- const monthsInYear = HDate.monthsInYear(year);
13069
- for (let month = 1; month <= monthsInYear; month++) {
13070
- const monthName = HDate.getMonthName(month, year);
13227
+ const numMonths = monthsInYear(year);
13228
+ for (let month = 1; month <= numMonths; month++) {
13229
+ const monthName = getMonthName(month, year);
13071
13230
  if (daysInPreviousMonth(month, year) === 30) {
13072
13231
  addToMap(map, new RoshChodeshEvent(new HDate(1, month, year), monthName));
13073
13232
  addToMap(map, new RoshChodeshEvent(new HDate(30, month - 1, year), monthName));
@@ -13078,9 +13237,9 @@ function addRoshChodesh(map, year) {
13078
13237
  }
13079
13238
  }
13080
13239
  function addYomKippurKatan(map, year) {
13081
- const monthsInYear = HDate.monthsInYear(year);
13240
+ const numMonths = monthsInYear(year);
13082
13241
  // start at Iyyar because one may not fast during Nisan
13083
- for (let month = IYYAR; month <= monthsInYear; month++) {
13242
+ for (let month = IYYAR; month <= numMonths; month++) {
13084
13243
  const nextMonth = month + 1;
13085
13244
  // Yom Kippur Katan is not observed on the day before Rosh Hashanah.
13086
13245
  // Not observed prior to Rosh Chodesh Cheshvan because Yom Kippur has just passed.
@@ -13090,17 +13249,17 @@ function addYomKippurKatan(map, year) {
13090
13249
  }
13091
13250
  let ykk = new HDate(29, month, year);
13092
13251
  const dow = ykk.getDay();
13093
- if (dow === FRI$1 || dow === SAT$2) {
13252
+ if (dow === FRI$1 || dow === SAT$1) {
13094
13253
  ykk = ykk.onOrBefore(THU);
13095
13254
  }
13096
- const nextMonthName = HDate.getMonthName(nextMonth, year);
13255
+ const nextMonthName = getMonthName(nextMonth, year);
13097
13256
  addToMap(map, new YomKippurKatanEvent(ykk, nextMonthName));
13098
13257
  }
13099
13258
  }
13100
13259
  function addBehab(map, year) {
13101
13260
  for (const month of [CHESHVAN, IYYAR]) {
13102
13261
  const roshChodesh = new HDate(1, month, year);
13103
- let shabbos = new HDate(HDate.dayOnOrBefore(SAT$2, roshChodesh.abs() + 6));
13262
+ let shabbos = new HDate(HDate.dayOnOrBefore(SAT$1, roshChodesh.abs() + 6));
13104
13263
  if (shabbos.abs() === roshChodesh.abs()) {
13105
13264
  shabbos = new HDate(shabbos.abs() + 7);
13106
13265
  }
@@ -13113,25 +13272,54 @@ function addBehab(map, year) {
13113
13272
  }
13114
13273
  }
13115
13274
  }
13275
+ /**
13276
+ * Holidays for an entire Hebrew year, indexed by R.D. day number
13277
+ * (`HDate.abs()`), so that per-day lookups don't have to build a date string.
13278
+ * The result is cached in an internal LRU and shared between callers.
13279
+ * @internal
13280
+ */
13281
+ function getHolidaysForYearByRd(year) {
13282
+ return getYearEntry(year).map;
13283
+ }
13116
13284
  /**
13117
13285
  * Lower-level holidays interface, which returns a `Map` of `Event`s indexed by
13118
13286
  * `HDate.toString()`. These events must filtered especially for `flags.IL_ONLY`
13119
13287
  * or `flags.CHUL_ONLY` depending on Israel vs. Diaspora holiday scheme.
13288
+ *
13289
+ * A string-keyed copy of {@link getHolidaysForYearByRd}, built once per
13290
+ * cached year; the event arrays are shared with it.
13120
13291
  * @internal
13121
13292
  */
13122
13293
  function getHolidaysForYear_(year) {
13294
+ const entry = getYearEntry(year);
13295
+ let strMap = stringMapCache.get(entry);
13296
+ if (strMap === undefined) {
13297
+ strMap = new Map();
13298
+ for (const [abs, events] of entry.map) {
13299
+ strMap.set(new HDate(abs).toString(), events);
13300
+ }
13301
+ stringMapCache.set(entry, strMap);
13302
+ }
13303
+ return strMap;
13304
+ }
13305
+ function getYearEntry(year) {
13306
+ const last = lastEntry;
13307
+ if (last?.year === year) {
13308
+ return last;
13309
+ }
13310
+ const entry = yearCache.get(year) ?? makeYearEntry(year);
13311
+ lastEntry = entry;
13312
+ return entry;
13313
+ }
13314
+ function makeYearEntry(year) {
13123
13315
  if (typeof year !== 'number') {
13124
13316
  throw new TypeError(`bad Hebrew year: ${year}`);
13125
13317
  }
13126
13318
  if (year < 1 || year > 32658) {
13127
13319
  throw new RangeError(`Hebrew year ${year} out of range 1-32658`);
13128
13320
  }
13129
- const cached = yearCache.get(year);
13130
- if (cached) {
13131
- return cached;
13132
- }
13133
13321
  const RH = new HDate(1, TISHREI$1, year);
13134
- const pesach = new HDate(15, NISAN$2, year);
13322
+ const pesach = new HDate(15, NISAN$1, year);
13135
13323
  const map = new Map();
13136
13324
  addStaticHolidays(map, year);
13137
13325
  addTishreiHolidays(map, year, RH);
@@ -13159,8 +13347,14 @@ function getHolidaysForYear_(year) {
13159
13347
  for (const arr of map.values()) {
13160
13348
  arr.sort((a, b) => timeOfDay(a) - timeOfDay(b));
13161
13349
  }
13162
- yearCache.set(year, map);
13163
- return map;
13350
+ const entry = {
13351
+ year,
13352
+ map,
13353
+ startAbs: RH.abs(),
13354
+ endAbs: hebrew2abs(year + 1, TISHREI$1, 1) - 1,
13355
+ };
13356
+ yearCache.set(year, entry);
13357
+ return entry;
13164
13358
  }
13165
13359
  /** 28 years of 365.25 days */
13166
13360
  const BIRKAT_HACHAMAH_CYCLE_DAYS = 10227;
@@ -13176,10 +13370,10 @@ const BIRKAT_HACHAMAH_REMAINDER = 172;
13176
13370
  * - 2 Iyyar 7141 (Gregorian year 3381)
13177
13371
  */
13178
13372
  function getBirkatHaChama(year) {
13179
- const leap = HDate.isLeapYear(year);
13180
- const startMonth = leap ? ADAR_II : NISAN$2;
13373
+ const leap = isLeapYear(year);
13374
+ const startMonth = leap ? ADAR_II : NISAN$1;
13181
13375
  const startDay = leap ? 20 : 1;
13182
- const baseRd = HDate.hebrew2abs(year, startMonth, startDay);
13376
+ const baseRd = hebrew2abs(year, startMonth, startDay);
13183
13377
  for (let day = 0; day <= 40; day++) {
13184
13378
  const abs = baseRd + day;
13185
13379
  const elapsed = abs + BIRKAT_HACHAMAH_EPOCH_OFFSET;
@@ -13204,141 +13398,25 @@ function getBirkatHaChama(year) {
13204
13398
  * @param il use the Israeli schedule for holidays
13205
13399
  */
13206
13400
  function getHolidaysForYearArray(year, il) {
13207
- const yearMap = getHolidaysForYear_(year);
13208
- const startAbs = HDate.hebrew2abs(year, TISHREI$1, 1);
13209
- const endAbs = HDate.hebrew2abs(year + 1, TISHREI$1, 1) - 1;
13401
+ const { map, startAbs, endAbs } = getYearEntry(year);
13402
+ const days = [];
13403
+ for (const abs of map.keys()) {
13404
+ if (abs >= startAbs && abs <= endAbs) {
13405
+ days.push(abs);
13406
+ }
13407
+ }
13408
+ days.sort((a, b) => a - b);
13210
13409
  const events = [];
13211
- for (let absDt = startAbs; absDt <= endAbs; absDt++) {
13212
- const hd = new HDate(absDt);
13213
- const holidays = yearMap.get(hd.toString());
13214
- if (holidays) {
13215
- events.push(...holidays.filter(ev => ev.observedIn(il)));
13410
+ for (const abs of days) {
13411
+ for (const ev of map.get(abs)) {
13412
+ if (ev.observedIn(il)) {
13413
+ events.push(ev);
13414
+ }
13216
13415
  }
13217
13416
  }
13218
13417
  return events;
13219
13418
  }
13220
13419
 
13221
- function isTomorrowShabbosOrYomTov(dow, events) {
13222
- return (dow === 5 ||
13223
- events.some(ev => ev.hasAnyFlag('LIGHT_CANDLES', 'LIGHT_CANDLES_TZEIS')));
13224
- }
13225
- /**
13226
- * Returns true if it is _Shabbos_ or if it is a _Yom Tov_ day that has a
13227
- * _melacha_ (work) prohibition.
13228
- *
13229
- * @param dow day of week, where `6` is Shabbos
13230
- * @param events events occurring on the day
13231
- * @return `true` if the day is a _Yom Tov_ that is _assur bemlacha_, or _Shabbos_
13232
- */
13233
- function isTodayAssurBemelacha(dow, events) {
13234
- return dow === 6 || events.some(ev => ev.hasFlag('CHAG'));
13235
- }
13236
- /**
13237
- * Returns `true` if the given moment (date + time) falls within a period
13238
- * when *melacha* (work) is prohibited — i.e. Shabbat or a Yom Tov.
13239
- *
13240
- * The Shabbat/Yom Tov window is taken to begin at sunset (shkiah) on the
13241
- * preceding day (Erev Shabbat / Erev Yom Tov / Yom Tov sheni) and to end
13242
- * at *tzais* (nightfall) on the day itself. *Tzais* is calculated using a
13243
- * solar depression of 8.5° for simplicity; consult a halachic authority
13244
- * for more stringent opinions.
13245
- *
13246
- * `useElevation` controls whether the location's elevation is taken into
13247
- * account when computing sunset (it has no effect on the degree-based
13248
- * tzais calculation). The Israel/Diaspora schedule comes from
13249
- * `location.getIsrael()`.
13250
- *
13251
- * Throws if sunset cannot be calculated for the given location
13252
- * (e.g. polar regions).
13253
- * @example
13254
- * import {isAssurBemlacha, Location} from '@hebcal/core';
13255
- * const loc = Location.lookup('Jerusalem')!;
13256
- * // Friday after sunset:
13257
- * isAssurBemlacha(new Date('2024-04-26T18:00:00Z'), loc, false); // true
13258
- * @param currentTime the moment to test (with hour/minute)
13259
- * @param location geographic location (also supplies Israel/Diaspora flag and tzid)
13260
- * @param useElevation include elevation when computing sunset
13261
- * @return `true` if *melacha* is prohibited, `false` if it is not
13262
- */
13263
- function isAssurBemlacha(currentTime, location, useElevation) {
13264
- // Determine the calendar date in the location's timezone, not the
13265
- // timezone of the computer running this code. Otherwise the day-of-week,
13266
- // Hebrew date and sunset/tzais times would depend on the machine's
13267
- // local timezone, giving different (incorrect) results near midnight.
13268
- const isoDate = getPseudoISO(location.getTzid(), currentTime);
13269
- const year = parseInt(isoDate.substring(0, 4), 10);
13270
- const month = parseInt(isoDate.substring(5, 7), 10);
13271
- const day = parseInt(isoDate.substring(8, 10), 10);
13272
- const hd = new HDate(new Date(year, month - 1, day));
13273
- const zmanim = new Zmanim(location, hd, useElevation);
13274
- // erev shabbos, YT or YT sheni and after shkiah
13275
- const sunset = zmanim.sunset();
13276
- const sunsetMillis = sunset.getTime();
13277
- if (Number.isNaN(sunsetMillis)) {
13278
- throw new Error('Could not determine sunset');
13279
- }
13280
- // erev shabbos, YT or YT sheni and after shkiah
13281
- const il = location.getIsrael();
13282
- const currentMillis = currentTime.getTime();
13283
- const dow = hd.getDay();
13284
- const events = getHolidaysOnDate(hd, il) ?? [];
13285
- if (isTomorrowShabbosOrYomTov(dow, events) && currentMillis >= sunsetMillis) {
13286
- return true;
13287
- }
13288
- // is shabbos or YT and it is before tzais
13289
- if (isTodayAssurBemelacha(dow, events)) {
13290
- const tzais = zmanim.tzeit();
13291
- const tzaisMillis = tzais.getTime();
13292
- return currentMillis <= tzaisMillis;
13293
- }
13294
- return false;
13295
- }
13296
-
13297
- const { NISAN: NISAN$1, SIVAN: SIVAN$1, TAMUZ, AV } = months;
13298
- const SAT$1 = 6;
13299
- function getHDate(date) {
13300
- return HDate.isHDate(date) ? date : new HDate(date);
13301
- }
13302
- function isSefiratHaOmer(hd) {
13303
- const hyear = hd.getFullYear();
13304
- const beginOmer = new HDate(16, NISAN$1, hyear).abs();
13305
- const endOmer = new HDate(5, SIVAN$1, hyear).abs();
13306
- const abs = hd.abs();
13307
- return abs >= beginOmer && abs <= endOmer;
13308
- }
13309
- function isBeinHaMetzarim(hd) {
13310
- const hyear = hd.getFullYear();
13311
- const begin = new HDate(17, TAMUZ, hyear).abs();
13312
- const tishaBav = new HDate(9, AV, hyear);
13313
- const end = tishaBav.getDay() === SAT$1 ? new HDate(10, AV, hyear).abs() : tishaBav.abs();
13314
- const abs = hd.abs();
13315
- return abs >= begin && abs <= end;
13316
- }
13317
- /**
13318
- * Returns `true` if the given date falls within a public period of communal
13319
- * mourning — specifically:
13320
- *
13321
- * - **Sefirat HaOmer**: 16 Nisan through 5 Sivan (the 49 days of the Omer).
13322
- * - **Bein HaMetzarim** ("between the straits"): 17 Tammuz through 9 Av
13323
- * (10 Av when 9 Av is postponed because it falls on Shabbat).
13324
- *
13325
- * This is a broad helper — it does not attempt to model minhag-specific
13326
- * exceptions within those periods (e.g. Lag BaOmer, Rosh Chodesh Iyar,
13327
- * the distinction between Sephardic and Ashkenazic customs on which
13328
- * portion of the Omer is observed as mourning, etc.).
13329
- * @example
13330
- * import {isAveilut, HDate, months} from '@hebcal/core';
13331
- * isAveilut(new HDate(20, months.NISAN, 5784)); // true (Omer)
13332
- * isAveilut(new HDate(25, months.TAMUZ, 5784)); // true (Three Weeks)
13333
- * isAveilut(new HDate(15, months.AV, 5784)); // false
13334
- * @param date Hebrew Date, Gregorian date, or absolute R.D. day number
13335
- * @return `true` if the date is during a mourning period
13336
- */
13337
- function isAveilut(date) {
13338
- const hd = getHDate(date);
13339
- return isSefiratHaOmer(hd) || isBeinHaMetzarim(hd);
13340
- }
13341
-
13342
13420
  /**
13343
13421
  * Returns `true` if the given date is observed as a major or minor fast day.
13344
13422
  *
@@ -13423,7 +13501,9 @@ const MINOR_FAST_END_MINUTES_IL = 15;
13423
13501
  * Returns `val` when it is a finite nonzero number, otherwise `undefined`
13424
13502
  */
13425
13503
  function nonzero(val) {
13426
- return typeof val === 'number' && isFinite(val) && val !== 0 ? val : undefined;
13504
+ return typeof val === 'number' && Number.isFinite(val) && val !== 0
13505
+ ? val
13506
+ : undefined;
13427
13507
  }
13428
13508
  /**
13429
13509
  * Computes the "Fast begins" time for a minor fast (one that begins at dawn).
@@ -13678,8 +13758,7 @@ function isShabbatOrChag(hd, il) {
13678
13758
  if (hd.getDay() === 6) {
13679
13759
  return true;
13680
13760
  }
13681
- const events = getHolidaysOnDate(hd, il) ?? [];
13682
- return events.some(ev => ev.hasFlag('CHAG'));
13761
+ return isYomTov(hd, il);
13683
13762
  }
13684
13763
  /**
13685
13764
  * Makes the "Latest Kiddush Levana" event for one Hebrew month, or
@@ -14242,8 +14321,8 @@ function tachanun0(hdate, il, checkNext) {
14242
14321
  return ret;
14243
14322
  }
14244
14323
  function tachanunYear(year, il) {
14245
- const leap = HDate.isLeapYear(year);
14246
- const monthsInYear = HDate.monthsInYear(year);
14324
+ const leap = isLeapYear(year);
14325
+ const numMonths = monthsInYear(year);
14247
14326
  let av9dt = new HDate(9, months.AV, year);
14248
14327
  if (av9dt.getDay() === 6) {
14249
14328
  av9dt = av9dt.next();
@@ -14256,13 +14335,13 @@ function tachanunYear(year, il) {
14256
14335
  new HDate(2, months.TISHREI, year), // Rosh Hashana II
14257
14336
  ].concat(
14258
14337
  // Rosh Chodesh - 1st of every month. Also includes RH day 1 (1 Tishrei)
14259
- range(1, monthsInYear).map(month => new HDate(1, month, year)),
14338
+ range(1, numMonths).map(month => new HDate(1, month, year)),
14260
14339
  // Rosh Chodesh - 30th of months that have one
14261
- range(1, monthsInYear)
14262
- .filter(month => HDate.daysInMonth(month, year) === 30)
14340
+ range(1, numMonths)
14341
+ .filter(month => daysInMonth(month, year) === 30)
14263
14342
  .map(month => new HDate(30, month, year)),
14264
14343
  // entire month of Nisan
14265
- range(1, HDate.daysInMonth(months.NISAN, year)).map(mday => new HDate(mday, months.NISAN, year)), new HDate(18, months.IYYAR, year), // Lag BaOmer
14344
+ range(1, daysInMonth(months.NISAN, year)).map(mday => new HDate(mday, months.NISAN, year)), new HDate(18, months.IYYAR, year), // Lag BaOmer
14266
14345
  // Rosh Chodesh Sivan thru Isru Chag
14267
14346
  range(1, 8 - (il ? 1 : 0)).map(mday => new HDate(mday, months.SIVAN, year)), av9dt, // Tisha B'Av
14268
14347
  new HDate(15, months.AV, year), // Tu B'Av
@@ -14344,7 +14423,7 @@ function hallel(hdate, il) {
14344
14423
  break;
14345
14424
  case months.TEVET: {
14346
14425
  // Chanukah lasts 8 days, ending on 2 Tevet (3 Tevet if Kislev is short)
14347
- const lastDay = HDate.shortKislev(hdate.getFullYear()) ? 3 : 2;
14426
+ const lastDay = shortKislev(hdate.getFullYear()) ? 3 : 2;
14348
14427
  if (dd <= lastDay) {
14349
14428
  return WHOLE;
14350
14429
  }
@@ -14487,7 +14566,7 @@ class ParshaEvent extends Event {
14487
14566
  function parshaYear(year, il) {
14488
14567
  const sedra = getSedra(year, il);
14489
14568
  const startAbs = sedra.getFirstSaturday();
14490
- const endAbs = HDate.hebrew2abs(year, months.ELUL, 29);
14569
+ const endAbs = hebrew2abs(year, months.ELUL, 29);
14491
14570
  const events = [];
14492
14571
  for (let absDt = startAbs; absDt <= endAbs; absDt += 7) {
14493
14572
  const parsha = sedra.lookup(absDt);
@@ -14567,7 +14646,7 @@ function getMonth(options) {
14567
14646
  return options.month;
14568
14647
  }
14569
14648
  }
14570
- return NaN;
14649
+ return Number.NaN;
14571
14650
  }
14572
14651
  function startEndGregorian(theMonth, theYear, numYears) {
14573
14652
  const gregMonth = theMonth ? theMonth - 1 : 0;
@@ -14708,7 +14787,7 @@ class MevarchimChodeshEvent extends Event {
14708
14787
  else {
14709
14788
  const hyear = date.getFullYear();
14710
14789
  const hmonth = date.getMonth();
14711
- const monNext = hmonth === HDate.monthsInYear(hyear) ? months.NISAN : hmonth + 1;
14790
+ const monNext = hmonth === monthsInYear(hyear) ? months.NISAN : hmonth + 1;
14712
14791
  const molad = new Molad(hyear, monNext);
14713
14792
  this.memo = molad.render('en', { hour12: false });
14714
14793
  }
@@ -14877,6 +14956,14 @@ class MevarchimChodeshEvent extends Event {
14877
14956
  * }
14878
14957
  */
14879
14958
  function calendar(options = {}) {
14959
+ return calendarImpl(options);
14960
+ }
14961
+ /**
14962
+ * Implementation of {@link calendar}. `allowSparse=false` forces the
14963
+ * visit-every-day path; tests use it to check the sparse path against it.
14964
+ * @internal
14965
+ */
14966
+ function calendarImpl(options, allowSparse) {
14880
14967
  options = { ...options }; // so we can modify freely
14881
14968
  const hasUserMask = typeof options.mask === 'number';
14882
14969
  // before checkCandleOptions(), because the mask can enable options
@@ -14905,6 +14992,8 @@ function calendar(options = {}) {
14905
14992
  let beginOmer = -1;
14906
14993
  let endOmer = -1;
14907
14994
  let currentYear = -1;
14995
+ let yearStartAbs = 0;
14996
+ let yearEndAbs = -1;
14908
14997
  let kiddushLevanaMonth = -1;
14909
14998
  let kiddushLevanaEv;
14910
14999
  const startAndEnd = getStartAndEnd(options);
@@ -14918,18 +15007,31 @@ function calendar(options = {}) {
14918
15007
  options.sedrot = false;
14919
15008
  options.dailyLearning = {};
14920
15009
  }
15010
+ const visit = !needsEveryDay(options)
15011
+ ? makeSparseDays(startAbs, endAbs, options)
15012
+ : undefined;
14921
15013
  for (let abs = startAbs; abs <= endAbs; abs++) {
14922
- const hd = new HDate(abs);
15014
+ if (visit !== undefined && visit[abs - startAbs] === 0) {
15015
+ continue;
15016
+ }
15017
+ // reuse a cached holiday's HDate when the day has one (HDate is
15018
+ // immutable); the table is keyed by abs, so its date is this day
15019
+ const hd = (abs >= yearStartAbs &&
15020
+ abs <= yearEndAbs &&
15021
+ holidaysYear.get(abs)?.[0]?.getDate()) ||
15022
+ new HDate(abs);
14923
15023
  const hyear = hd.getFullYear();
14924
15024
  if (hyear !== currentYear) {
14925
15025
  currentYear = hyear;
14926
- holidaysYear = getHolidaysForYear_(currentYear);
15026
+ holidaysYear = getHolidaysForYearByRd(currentYear);
15027
+ yearStartAbs = hebrew2abs(hyear, months.TISHREI, 1);
15028
+ yearEndAbs = hebrew2abs(hyear + 1, months.TISHREI, 1) - 1;
14927
15029
  if (options.sedrot) {
14928
15030
  sedra = getSedra(currentYear, il);
14929
15031
  }
14930
15032
  if (options.omer) {
14931
- beginOmer = HDate.hebrew2abs(currentYear, NISAN, 16);
14932
- endOmer = HDate.hebrew2abs(currentYear, SIVAN, 5);
15033
+ beginOmer = hebrew2abs(currentYear, NISAN, 16);
15034
+ endOmer = hebrew2abs(currentYear, SIVAN, 5);
14933
15035
  }
14934
15036
  }
14935
15037
  const prevEventsLength = evts.length;
@@ -14937,7 +15039,7 @@ function calendar(options = {}) {
14937
15039
  const isFriday = dow === FRI;
14938
15040
  const isSaturday = dow === SAT;
14939
15041
  let candlesEv;
14940
- const holidays0 = holidaysYear.get(hd.toString()) || [];
15042
+ const holidays0 = holidaysYear.get(abs) || [];
14941
15043
  const holidays = holidays0.filter(ev => ev.observedIn(il));
14942
15044
  if (options.sedrot && isSaturday) {
14943
15045
  const parsha0 = sedra.lookup(abs);
@@ -15036,6 +15138,56 @@ function calendar(options = {}) {
15036
15138
  }
15037
15139
  const FRI = 5;
15038
15140
  const SAT = 6;
15141
+ /**
15142
+ * True when some option can add an event on a day that has no holiday
15143
+ * (or, for molad/Shabbat Mevarchim, on a Saturday). Otherwise calendar()
15144
+ * only needs to visit the days returned by {@link makeSparseDays}, and
15145
+ * produces identical output: it runs the same per-day code on those days.
15146
+ */
15147
+ function needsEveryDay(options) {
15148
+ if (options.candlelighting ||
15149
+ options.sedrot ||
15150
+ options.omer ||
15151
+ options.addHebrewDates ||
15152
+ options.addHebrewDatesForEvents ||
15153
+ options.kiddushLevanaMaharil ||
15154
+ options.yizkor) {
15155
+ return true;
15156
+ }
15157
+ const dailyLearning = options.dailyLearning;
15158
+ return (typeof dailyLearning === 'object' &&
15159
+ dailyLearning !== null &&
15160
+ Object.values(dailyLearning).some(Boolean));
15161
+ }
15162
+ /**
15163
+ * Marks (with 1) each day in `[startAbs, endAbs]` that has an entry in its
15164
+ * Hebrew year's holiday table, plus every Saturday when molad or Shabbat
15165
+ * Mevarchim is requested. Holiday tables are cached per Hebrew year, so this
15166
+ * skips constructing an `HDate` for the ~3/4 of days with nothing on them.
15167
+ */
15168
+ function makeSparseDays(startAbs, endAbs, options) {
15169
+ const visit = new Uint8Array(endAbs - startAbs + 1);
15170
+ const startYear = new HDate(startAbs).getFullYear();
15171
+ const endYear = new HDate(endAbs).getFullYear();
15172
+ for (let hy = startYear; hy <= endYear; hy++) {
15173
+ // a year's table may hold days of adjacent years (e.g. Erev Rosh
15174
+ // Hashana); calendar() reads each day from its own year's table
15175
+ const lo = Math.max(startAbs, hebrew2abs(hy, months.TISHREI, 1));
15176
+ const hi = Math.min(endAbs, hebrew2abs(hy + 1, months.TISHREI, 1) - 1);
15177
+ for (const abs of getHolidaysForYearByRd(hy).keys()) {
15178
+ if (abs >= lo && abs <= hi) {
15179
+ visit[abs - startAbs] = 1;
15180
+ }
15181
+ }
15182
+ }
15183
+ if (options.molad || options.shabbatMevarchim) {
15184
+ const firstSat = HDate.dayOnOrBefore(SAT, startAbs + 6);
15185
+ for (let abs = firstSat; abs <= endAbs; abs += 7) {
15186
+ visit[abs - startAbs] = 1;
15187
+ }
15188
+ }
15189
+ return visit;
15190
+ }
15039
15191
  const { NISAN, SIVAN, ELUL } = months;
15040
15192
  const { LIGHT_CANDLES, YOM_TOV_ENDS, CHUL_ONLY, IL_ONLY, LIGHT_CANDLES_TZEIS, CHANUKAH_CANDLES, MINOR_FAST, SPECIAL_SHABBAT, MODERN_HOLIDAY, MAJOR_FAST, ROSH_CHODESH, PARSHA_HASHAVUA, DAF_YOMI, MISHNA_YOMI, NACH_YOMI, YERUSHALMI_YOMI, OMER_COUNT, SHABBAT_MEVARCHIM, MINOR_HOLIDAY, EREV, CHOL_HAMOED, YOM_KIPPUR_KATAN, YIZKOR, BEHAB, KIDDUSH_LEVANA, } = flags;
15041
15193
  const unrecognizedAlreadyWarned = new Set();
@@ -15420,12 +15572,12 @@ function makeMoladAndMevarchimChodesh(hd, options) {
15420
15572
  const hdate = hd.getDate();
15421
15573
  if (hmonth !== ELUL && hdate >= 23 && hdate <= 29) {
15422
15574
  const hyear = hd.getFullYear();
15423
- const monNext = hmonth === HDate.monthsInYear(hyear) ? NISAN : hmonth + 1;
15575
+ const monNext = hmonth === monthsInYear(hyear) ? NISAN : hmonth + 1;
15424
15576
  if (options.molad) {
15425
15577
  evts.push(new MoladEvent(hd, hyear, monNext, options));
15426
15578
  }
15427
15579
  if (options.shabbatMevarchim) {
15428
- const nextMonthName = HDate.getMonthName(monNext, hyear);
15580
+ const nextMonthName = getMonthName(monNext, hyear);
15429
15581
  const molad = new Molad(hyear, monNext);
15430
15582
  const memo = molad.render(options.locale, options);
15431
15583
  evts.push(new MevarchimChodeshEvent(hd, nextMonthName, memo, options.locale));
@@ -15712,7 +15864,7 @@ class HebrewCalendar {
15712
15864
  const today = new HDate(date);
15713
15865
  const friday = today.after(5);
15714
15866
  const tomorrow = today.next();
15715
- return isChag(friday, il) && !isChag(today, il) && isChag(tomorrow, il);
15867
+ return isYomTov(friday, il) && !isYomTov(today, il) && isYomTov(tomorrow, il);
15716
15868
  }
15717
15869
  /**
15718
15870
  * Helper function to format a 24-hour (00:00-23:59) time string in either
@@ -15811,10 +15963,6 @@ class HebrewCalendar {
15811
15963
  return tachanun(hdate, il);
15812
15964
  }
15813
15965
  }
15814
- function isChag(date, il) {
15815
- const events = getHolidaysOnDate(date, il) ?? [];
15816
- return events.some(ev => ev.hasFlag('CHAG'));
15817
- }
15818
15966
 
15819
15967
  exports.AsaraBTevetEvent = AsaraBTevetEvent;
15820
15968
  exports.CandleLightingEvent = CandleLightingEvent;
@@ -15858,6 +16006,7 @@ exports.holidayDesc = holidayDesc;
15858
16006
  exports.isAssurBemlacha = isAssurBemlacha;
15859
16007
  exports.isAveilut = isAveilut;
15860
16008
  exports.isFastDay = isFastDay;
16009
+ exports.isYomTov = isYomTov;
15861
16010
  exports.months = months;
15862
16011
  exports.parshaYear = parshaYear;
15863
16012
  exports.parshiot = parshiot;