@hebcal/core 6.16.3 → 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.
- package/dist/bundle.js +245 -176
- package/dist/bundle.js.map +1 -1
- package/dist/bundle.min.js +5 -5
- package/dist/bundle.min.js.map +1 -1
- package/dist/esm/DailyLearning.js +1 -1
- package/dist/esm/HebrewDateEvent.js +1 -1
- package/dist/esm/HolidayEvent.js +1 -1
- package/dist/esm/KiddushLevanaEvent.js +1 -1
- package/dist/esm/MevarchimChodeshEvent.js +3 -3
- package/dist/esm/MevarchimChodeshEvent.js.map +1 -1
- package/dist/esm/ParshaEvent.js +1 -1
- package/dist/esm/TimedEvent.js +1 -1
- package/dist/esm/YomKippurKatanEvent.js +1 -1
- package/dist/esm/ashkenazi.po.js +1 -1
- package/dist/esm/calendar.d.ts +6 -0
- package/dist/esm/calendar.js +81 -8
- package/dist/esm/calendar.js.map +1 -1
- package/dist/esm/candles.js +1 -1
- package/dist/esm/cities.json.js +1 -1
- package/dist/esm/event.js +7 -3
- package/dist/esm/event.js.map +1 -1
- package/dist/esm/getStartAndEnd.js +1 -1
- package/dist/esm/hallel.js +3 -3
- package/dist/esm/hallel.js.map +1 -1
- package/dist/esm/he-x-NoNikud.po.js +1 -1
- package/dist/esm/he.po.js +1 -1
- package/dist/esm/hebcal.js +1 -1
- package/dist/esm/holidays.js +15 -15
- package/dist/esm/holidays.js.map +1 -1
- package/dist/esm/horizon.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/isAssurBemlacha.js +1 -1
- package/dist/esm/isAveilut.js +1 -1
- package/dist/esm/isFastDay.js +1 -1
- package/dist/esm/isYomTov.js +1 -1
- package/dist/esm/locale.js +1 -1
- package/dist/esm/location.js +1 -1
- package/dist/esm/modern.js +1 -1
- package/dist/esm/molad.js +3 -3
- package/dist/esm/molad.js.map +1 -1
- package/dist/esm/moladBase.js +1 -1
- package/dist/esm/moladDate.js +1 -1
- package/dist/esm/omer.js +1 -1
- package/dist/esm/parshaName.js +1 -1
- package/dist/esm/parshaYear.js +3 -3
- package/dist/esm/parshaYear.js.map +1 -1
- package/dist/esm/pkgVersion.d.ts +1 -1
- package/dist/esm/pkgVersion.js +2 -2
- package/dist/esm/pkgVersion.js.map +1 -1
- package/dist/esm/reformatTimeStr.js +1 -1
- package/dist/esm/sedra.js +5 -5
- package/dist/esm/sedra.js.map +1 -1
- package/dist/esm/sefira.json.js +1 -1
- package/dist/esm/staticHolidays.js +1 -1
- package/dist/esm/string.js +1 -1
- package/dist/esm/tachanun.js +8 -8
- package/dist/esm/tachanun.js.map +1 -1
- package/dist/esm/zenith.js +1 -1
- package/dist/esm/zmanim.js +1 -1
- package/package.json +2 -2
package/dist/bundle.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
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.
|
|
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
|
-
|
|
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
|
|
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
|
|
3256
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
3899
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
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
|
|
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.
|
|
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.
|
|
4072
|
-
const dayEpochNano1 = relativeOps.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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,
|
|
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.
|
|
4299
|
+
return calendar ? calendar.ne(year, month, monthDelta) : addIsoMonths(year, month, monthDelta);
|
|
4292
4300
|
}
|
|
4293
4301
|
|
|
4294
|
-
function resolveMonthInMovedYear(calendar, monthCodeNumber, isLeapMonth,
|
|
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)
|
|
4324
|
-
|
|
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(
|
|
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
|
-
|
|
4361
|
-
|
|
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
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
const
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
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
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
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:
|
|
4530
|
-
months:
|
|
4531
|
-
days:
|
|
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
|
|
4557
|
-
return
|
|
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.
|
|
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
|
-
|
|
4568
|
-
|
|
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
|
-
|
|
4575
|
-
|
|
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((
|
|
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)),
|
|
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
|
-
|
|
4729
|
-
|
|
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
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
4967
|
-
isLeapMonth = 0, day = constrainToRange(requestedDay, 1, (calendar && calendar.
|
|
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
|
-
|
|
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 = (
|
|
5239
|
+
const format = (normId => new RawDateTimeFormat("en-u-hc-h23", {
|
|
5242
5240
|
calendar: "iso8601",
|
|
5243
|
-
timeZone:
|
|
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.
|
|
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.
|
|
5267
|
+
this.id = id, this.m = compareKey, this.X = offsetNano;
|
|
5271
5268
|
}
|
|
5272
5269
|
B() {
|
|
5273
|
-
return this.
|
|
5270
|
+
return this.X;
|
|
5274
5271
|
}
|
|
5275
|
-
|
|
5276
|
-
return [ isoDateTimeAndOffsetToEpochNano(isoDateTime, this.
|
|
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.
|
|
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.
|
|
5362
|
+
return this.oe.ze((epochNano => epochNanoToSecMod(epochNano)[0])(epochNano)) * nanoInSec;
|
|
5366
5363
|
}
|
|
5367
|
-
|
|
5364
|
+
N(isoDateTime) {
|
|
5368
5365
|
const zonedEpochSec = 86400 * isoDateToEpochDays(isoDateTime) + timeFieldsToSec(isoDateTime);
|
|
5369
5366
|
const subsecNano = timeFieldsToSubsecNano(isoDateTime);
|
|
5370
|
-
return this.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
6057
|
+
const [format, ...rest] = internals.Z.A(record);
|
|
6062
6058
|
return format.format(...rest);
|
|
6063
6059
|
});
|
|
6064
6060
|
}
|
|
6065
6061
|
formatToParts(record) {
|
|
6066
|
-
const {
|
|
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 {
|
|
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 {
|
|
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
|
}
|
|
@@ -9699,7 +9695,7 @@ class Molad {
|
|
|
9699
9695
|
* for example 'Elul' or 'Cheshvan'.
|
|
9700
9696
|
*/
|
|
9701
9697
|
getMonthName() {
|
|
9702
|
-
return
|
|
9698
|
+
return getMonthName(this.month, this.year);
|
|
9703
9699
|
}
|
|
9704
9700
|
/**
|
|
9705
9701
|
* @returns Day of Week (0=Sunday, 6=Saturday)
|
|
@@ -12248,8 +12244,8 @@ const INCOMPLETE = 0;
|
|
|
12248
12244
|
const REGULAR = 1;
|
|
12249
12245
|
const COMPLETE = 2;
|
|
12250
12246
|
function yearType(hyear) {
|
|
12251
|
-
const longC =
|
|
12252
|
-
const shortK =
|
|
12247
|
+
const longC = longCheshvan(hyear);
|
|
12248
|
+
const shortK = shortKislev(hyear);
|
|
12253
12249
|
if (longC && !shortK) {
|
|
12254
12250
|
return COMPLETE;
|
|
12255
12251
|
}
|
|
@@ -12291,7 +12287,7 @@ class Sedra {
|
|
|
12291
12287
|
const rhDay = rh0.getDay() + 1;
|
|
12292
12288
|
// find the first Saturday on or after Rosh Hashana
|
|
12293
12289
|
this.firstSaturday = HDate.dayOnOrBefore(6, rh + 6);
|
|
12294
|
-
const leap = +
|
|
12290
|
+
const leap = +isLeapYear(hyear);
|
|
12295
12291
|
this.il = Boolean(il);
|
|
12296
12292
|
const type = yearType(hyear);
|
|
12297
12293
|
let key = `${leap}${rhDay}${type}`;
|
|
@@ -13171,7 +13167,7 @@ function addTishreiHolidays(map, year, RH) {
|
|
|
13171
13167
|
new HolidayEvent(new HDate(HDate.dayOnOrBefore(SAT$1, 7 + RH.abs())), holidayDesc.SHABBAT_SHUVA, SPECIAL_SHABBAT$1));
|
|
13172
13168
|
}
|
|
13173
13169
|
function addChanukahAndTevet(map, year) {
|
|
13174
|
-
const rchTevet =
|
|
13170
|
+
const rchTevet = shortKislev(year)
|
|
13175
13171
|
? new HDate(1, TEVET, year)
|
|
13176
13172
|
: new HDate(30, KISLEV, year);
|
|
13177
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));
|
|
@@ -13199,7 +13195,7 @@ function addPurimVariants(map, year, pesach) {
|
|
|
13199
13195
|
if (pesach.getDay() === SUN) {
|
|
13200
13196
|
addToMap(map, new HolidayEvent(new HDate(16, ADAR_II, year), holidayDesc.PURIM_MESHULASH, MINOR_HOLIDAY$1));
|
|
13201
13197
|
}
|
|
13202
|
-
if (
|
|
13198
|
+
if (isLeapYear(year)) {
|
|
13203
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: '🎭️' }));
|
|
13204
13200
|
}
|
|
13205
13201
|
}
|
|
@@ -13224,13 +13220,13 @@ function addSummerFasts(map, year) {
|
|
|
13224
13220
|
}
|
|
13225
13221
|
function daysInPreviousMonth(month, year) {
|
|
13226
13222
|
return month === NISAN$1
|
|
13227
|
-
?
|
|
13228
|
-
:
|
|
13223
|
+
? daysInMonth(monthsInYear(year - 1), year - 1)
|
|
13224
|
+
: daysInMonth(month - 1, year);
|
|
13229
13225
|
}
|
|
13230
13226
|
function addRoshChodesh(map, year) {
|
|
13231
|
-
const
|
|
13232
|
-
for (let month = 1; month <=
|
|
13233
|
-
const monthName =
|
|
13227
|
+
const numMonths = monthsInYear(year);
|
|
13228
|
+
for (let month = 1; month <= numMonths; month++) {
|
|
13229
|
+
const monthName = getMonthName(month, year);
|
|
13234
13230
|
if (daysInPreviousMonth(month, year) === 30) {
|
|
13235
13231
|
addToMap(map, new RoshChodeshEvent(new HDate(1, month, year), monthName));
|
|
13236
13232
|
addToMap(map, new RoshChodeshEvent(new HDate(30, month - 1, year), monthName));
|
|
@@ -13241,9 +13237,9 @@ function addRoshChodesh(map, year) {
|
|
|
13241
13237
|
}
|
|
13242
13238
|
}
|
|
13243
13239
|
function addYomKippurKatan(map, year) {
|
|
13244
|
-
const
|
|
13240
|
+
const numMonths = monthsInYear(year);
|
|
13245
13241
|
// start at Iyyar because one may not fast during Nisan
|
|
13246
|
-
for (let month = IYYAR; month <=
|
|
13242
|
+
for (let month = IYYAR; month <= numMonths; month++) {
|
|
13247
13243
|
const nextMonth = month + 1;
|
|
13248
13244
|
// Yom Kippur Katan is not observed on the day before Rosh Hashanah.
|
|
13249
13245
|
// Not observed prior to Rosh Chodesh Cheshvan because Yom Kippur has just passed.
|
|
@@ -13256,7 +13252,7 @@ function addYomKippurKatan(map, year) {
|
|
|
13256
13252
|
if (dow === FRI$1 || dow === SAT$1) {
|
|
13257
13253
|
ykk = ykk.onOrBefore(THU);
|
|
13258
13254
|
}
|
|
13259
|
-
const nextMonthName =
|
|
13255
|
+
const nextMonthName = getMonthName(nextMonth, year);
|
|
13260
13256
|
addToMap(map, new YomKippurKatanEvent(ykk, nextMonthName));
|
|
13261
13257
|
}
|
|
13262
13258
|
}
|
|
@@ -13355,7 +13351,7 @@ function makeYearEntry(year) {
|
|
|
13355
13351
|
year,
|
|
13356
13352
|
map,
|
|
13357
13353
|
startAbs: RH.abs(),
|
|
13358
|
-
endAbs:
|
|
13354
|
+
endAbs: hebrew2abs(year + 1, TISHREI$1, 1) - 1,
|
|
13359
13355
|
};
|
|
13360
13356
|
yearCache.set(year, entry);
|
|
13361
13357
|
return entry;
|
|
@@ -13374,10 +13370,10 @@ const BIRKAT_HACHAMAH_REMAINDER = 172;
|
|
|
13374
13370
|
* - 2 Iyyar 7141 (Gregorian year 3381)
|
|
13375
13371
|
*/
|
|
13376
13372
|
function getBirkatHaChama(year) {
|
|
13377
|
-
const leap =
|
|
13373
|
+
const leap = isLeapYear(year);
|
|
13378
13374
|
const startMonth = leap ? ADAR_II : NISAN$1;
|
|
13379
13375
|
const startDay = leap ? 20 : 1;
|
|
13380
|
-
const baseRd =
|
|
13376
|
+
const baseRd = hebrew2abs(year, startMonth, startDay);
|
|
13381
13377
|
for (let day = 0; day <= 40; day++) {
|
|
13382
13378
|
const abs = baseRd + day;
|
|
13383
13379
|
const elapsed = abs + BIRKAT_HACHAMAH_EPOCH_OFFSET;
|
|
@@ -14325,8 +14321,8 @@ function tachanun0(hdate, il, checkNext) {
|
|
|
14325
14321
|
return ret;
|
|
14326
14322
|
}
|
|
14327
14323
|
function tachanunYear(year, il) {
|
|
14328
|
-
const leap =
|
|
14329
|
-
const
|
|
14324
|
+
const leap = isLeapYear(year);
|
|
14325
|
+
const numMonths = monthsInYear(year);
|
|
14330
14326
|
let av9dt = new HDate(9, months.AV, year);
|
|
14331
14327
|
if (av9dt.getDay() === 6) {
|
|
14332
14328
|
av9dt = av9dt.next();
|
|
@@ -14339,13 +14335,13 @@ function tachanunYear(year, il) {
|
|
|
14339
14335
|
new HDate(2, months.TISHREI, year), // Rosh Hashana II
|
|
14340
14336
|
].concat(
|
|
14341
14337
|
// Rosh Chodesh - 1st of every month. Also includes RH day 1 (1 Tishrei)
|
|
14342
|
-
range(1,
|
|
14338
|
+
range(1, numMonths).map(month => new HDate(1, month, year)),
|
|
14343
14339
|
// Rosh Chodesh - 30th of months that have one
|
|
14344
|
-
range(1,
|
|
14345
|
-
.filter(month =>
|
|
14340
|
+
range(1, numMonths)
|
|
14341
|
+
.filter(month => daysInMonth(month, year) === 30)
|
|
14346
14342
|
.map(month => new HDate(30, month, year)),
|
|
14347
14343
|
// entire month of Nisan
|
|
14348
|
-
range(1,
|
|
14344
|
+
range(1, daysInMonth(months.NISAN, year)).map(mday => new HDate(mday, months.NISAN, year)), new HDate(18, months.IYYAR, year), // Lag BaOmer
|
|
14349
14345
|
// Rosh Chodesh Sivan thru Isru Chag
|
|
14350
14346
|
range(1, 8 - (il ? 1 : 0)).map(mday => new HDate(mday, months.SIVAN, year)), av9dt, // Tisha B'Av
|
|
14351
14347
|
new HDate(15, months.AV, year), // Tu B'Av
|
|
@@ -14427,7 +14423,7 @@ function hallel(hdate, il) {
|
|
|
14427
14423
|
break;
|
|
14428
14424
|
case months.TEVET: {
|
|
14429
14425
|
// Chanukah lasts 8 days, ending on 2 Tevet (3 Tevet if Kislev is short)
|
|
14430
|
-
const lastDay =
|
|
14426
|
+
const lastDay = shortKislev(hdate.getFullYear()) ? 3 : 2;
|
|
14431
14427
|
if (dd <= lastDay) {
|
|
14432
14428
|
return WHOLE;
|
|
14433
14429
|
}
|
|
@@ -14570,7 +14566,7 @@ class ParshaEvent extends Event {
|
|
|
14570
14566
|
function parshaYear(year, il) {
|
|
14571
14567
|
const sedra = getSedra(year, il);
|
|
14572
14568
|
const startAbs = sedra.getFirstSaturday();
|
|
14573
|
-
const endAbs =
|
|
14569
|
+
const endAbs = hebrew2abs(year, months.ELUL, 29);
|
|
14574
14570
|
const events = [];
|
|
14575
14571
|
for (let absDt = startAbs; absDt <= endAbs; absDt += 7) {
|
|
14576
14572
|
const parsha = sedra.lookup(absDt);
|
|
@@ -14791,7 +14787,7 @@ class MevarchimChodeshEvent extends Event {
|
|
|
14791
14787
|
else {
|
|
14792
14788
|
const hyear = date.getFullYear();
|
|
14793
14789
|
const hmonth = date.getMonth();
|
|
14794
|
-
const monNext = hmonth ===
|
|
14790
|
+
const monNext = hmonth === monthsInYear(hyear) ? months.NISAN : hmonth + 1;
|
|
14795
14791
|
const molad = new Molad(hyear, monNext);
|
|
14796
14792
|
this.memo = molad.render('en', { hour12: false });
|
|
14797
14793
|
}
|
|
@@ -14960,6 +14956,14 @@ class MevarchimChodeshEvent extends Event {
|
|
|
14960
14956
|
* }
|
|
14961
14957
|
*/
|
|
14962
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) {
|
|
14963
14967
|
options = { ...options }; // so we can modify freely
|
|
14964
14968
|
const hasUserMask = typeof options.mask === 'number';
|
|
14965
14969
|
// before checkCandleOptions(), because the mask can enable options
|
|
@@ -14988,6 +14992,8 @@ function calendar(options = {}) {
|
|
|
14988
14992
|
let beginOmer = -1;
|
|
14989
14993
|
let endOmer = -1;
|
|
14990
14994
|
let currentYear = -1;
|
|
14995
|
+
let yearStartAbs = 0;
|
|
14996
|
+
let yearEndAbs = -1;
|
|
14991
14997
|
let kiddushLevanaMonth = -1;
|
|
14992
14998
|
let kiddushLevanaEv;
|
|
14993
14999
|
const startAndEnd = getStartAndEnd(options);
|
|
@@ -15001,18 +15007,31 @@ function calendar(options = {}) {
|
|
|
15001
15007
|
options.sedrot = false;
|
|
15002
15008
|
options.dailyLearning = {};
|
|
15003
15009
|
}
|
|
15010
|
+
const visit = !needsEveryDay(options)
|
|
15011
|
+
? makeSparseDays(startAbs, endAbs, options)
|
|
15012
|
+
: undefined;
|
|
15004
15013
|
for (let abs = startAbs; abs <= endAbs; abs++) {
|
|
15005
|
-
|
|
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);
|
|
15006
15023
|
const hyear = hd.getFullYear();
|
|
15007
15024
|
if (hyear !== currentYear) {
|
|
15008
15025
|
currentYear = hyear;
|
|
15009
15026
|
holidaysYear = getHolidaysForYearByRd(currentYear);
|
|
15027
|
+
yearStartAbs = hebrew2abs(hyear, months.TISHREI, 1);
|
|
15028
|
+
yearEndAbs = hebrew2abs(hyear + 1, months.TISHREI, 1) - 1;
|
|
15010
15029
|
if (options.sedrot) {
|
|
15011
15030
|
sedra = getSedra(currentYear, il);
|
|
15012
15031
|
}
|
|
15013
15032
|
if (options.omer) {
|
|
15014
|
-
beginOmer =
|
|
15015
|
-
endOmer =
|
|
15033
|
+
beginOmer = hebrew2abs(currentYear, NISAN, 16);
|
|
15034
|
+
endOmer = hebrew2abs(currentYear, SIVAN, 5);
|
|
15016
15035
|
}
|
|
15017
15036
|
}
|
|
15018
15037
|
const prevEventsLength = evts.length;
|
|
@@ -15119,6 +15138,56 @@ function calendar(options = {}) {
|
|
|
15119
15138
|
}
|
|
15120
15139
|
const FRI = 5;
|
|
15121
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
|
+
}
|
|
15122
15191
|
const { NISAN, SIVAN, ELUL } = months;
|
|
15123
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;
|
|
15124
15193
|
const unrecognizedAlreadyWarned = new Set();
|
|
@@ -15503,12 +15572,12 @@ function makeMoladAndMevarchimChodesh(hd, options) {
|
|
|
15503
15572
|
const hdate = hd.getDate();
|
|
15504
15573
|
if (hmonth !== ELUL && hdate >= 23 && hdate <= 29) {
|
|
15505
15574
|
const hyear = hd.getFullYear();
|
|
15506
|
-
const monNext = hmonth ===
|
|
15575
|
+
const monNext = hmonth === monthsInYear(hyear) ? NISAN : hmonth + 1;
|
|
15507
15576
|
if (options.molad) {
|
|
15508
15577
|
evts.push(new MoladEvent(hd, hyear, monNext, options));
|
|
15509
15578
|
}
|
|
15510
15579
|
if (options.shabbatMevarchim) {
|
|
15511
|
-
const nextMonthName =
|
|
15580
|
+
const nextMonthName = getMonthName(monNext, hyear);
|
|
15512
15581
|
const molad = new Molad(hyear, monNext);
|
|
15513
15582
|
const memo = molad.render(options.locale, options);
|
|
15514
15583
|
evts.push(new MevarchimChodeshEvent(hd, nextMonthName, memo, options.locale));
|