@hebcal/core 6.14.7 → 6.16.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/README.md +25 -0
- package/dist/bundle.js +699 -404
- 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.d.ts +1 -1
- package/dist/esm/HolidayEvent.js +3 -3
- package/dist/esm/HolidayEvent.js.map +1 -1
- package/dist/esm/KiddushLevanaEvent.js +1 -1
- package/dist/esm/MevarchimChodeshEvent.js +1 -1
- package/dist/esm/ParshaEvent.js +2 -2
- package/dist/esm/ParshaEvent.js.map +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.js +1 -1
- package/dist/esm/candles.js +1 -1
- package/dist/esm/cities.json.js +1 -1
- package/dist/esm/event.js +1 -1
- package/dist/esm/getStartAndEnd.js +1 -1
- package/dist/esm/hallel.d.ts +26 -3
- package/dist/esm/hallel.js +86 -29
- 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.d.ts +3 -9
- package/dist/esm/hebcal.js +6 -16
- package/dist/esm/hebcal.js.map +1 -1
- package/dist/esm/holidays.js +1 -1
- package/dist/esm/horizon.d.ts +94 -0
- package/dist/esm/horizon.js +146 -0
- package/dist/esm/horizon.js.map +1 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +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/locale.js +1 -1
- package/dist/esm/location.js +1 -1
- package/dist/esm/modern.js +1 -1
- package/dist/esm/molad.js +1 -1
- package/dist/esm/moladBase.js +1 -1
- package/dist/esm/moladDate.js +1 -1
- package/dist/esm/omer.d.ts +4 -0
- package/dist/esm/omer.js +6 -2
- package/dist/esm/omer.js.map +1 -1
- package/dist/esm/parshaName.js +1 -1
- package/dist/esm/parshaYear.js +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 +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 +1 -1
- package/dist/esm/zenith.d.ts +2 -1
- package/dist/esm/zenith.js +4 -3
- package/dist/esm/zenith.js.map +1 -1
- package/dist/esm/zmanim.d.ts +117 -5
- package/dist/esm/zmanim.js +202 -8
- package/dist/esm/zmanim.js.map +1 -1
- package/package.json +9 -9
package/dist/bundle.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/*! @hebcal/core v6.
|
|
1
|
+
/*! @hebcal/core v6.16.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.16.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
|
/**
|
|
@@ -2965,8 +2965,6 @@ const invalidEntity = invalidEntity$1;
|
|
|
2965
2965
|
|
|
2966
2966
|
const missingField = fieldName => `Missing ${fieldName}`;
|
|
2967
2967
|
|
|
2968
|
-
const noValidFields = validFields => "No valid fields: " + validFields.join();
|
|
2969
|
-
|
|
2970
2968
|
const invalidBag = "Invalid bag";
|
|
2971
2969
|
|
|
2972
2970
|
const invalidChoice = (fieldName, val, choiceMap) => invalidEntity$1(fieldName, val) + "; must be " + Object.keys(choiceMap).join();
|
|
@@ -2989,8 +2987,6 @@ const outOfBoundsDate = "Out-of-bounds date";
|
|
|
2989
2987
|
|
|
2990
2988
|
const failedParse = s => `Cannot parse: ${s}`;
|
|
2991
2989
|
|
|
2992
|
-
const invalidSubstring = substring => `Invalid substring: ${substring}`;
|
|
2993
|
-
|
|
2994
2990
|
const invalidFormatType = branding => `Cannot format ${branding}`;
|
|
2995
2991
|
|
|
2996
2992
|
const mismatchingFormatTypes = "Mismatching types for formatting";
|
|
@@ -3020,12 +3016,13 @@ function clampEntity(entityName, num, min, max, overflow, choices) {
|
|
|
3020
3016
|
clamped;
|
|
3021
3017
|
}
|
|
3022
3018
|
|
|
3023
|
-
function memoize(generator, MapClass = Map) {
|
|
3019
|
+
function memoize(generator, MapClass = Map, maxSize = 1e4) {
|
|
3024
3020
|
const map = new MapClass;
|
|
3025
3021
|
return (key, ...otherArgs) => {
|
|
3026
3022
|
if (map.has(key)) {
|
|
3027
3023
|
return map.get(key);
|
|
3028
3024
|
}
|
|
3025
|
+
map.size >= maxSize && map.clear();
|
|
3029
3026
|
const val = generator(key, ...otherArgs);
|
|
3030
3027
|
return map.set(key, val), val;
|
|
3031
3028
|
};
|
|
@@ -3117,17 +3114,13 @@ function sortStrings(...strss) {
|
|
|
3117
3114
|
}
|
|
3118
3115
|
|
|
3119
3116
|
function createRegExp(meat) {
|
|
3120
|
-
return new RegExp(`^${meat}
|
|
3117
|
+
return new RegExp(`^${meat}$`);
|
|
3121
3118
|
}
|
|
3122
3119
|
|
|
3123
3120
|
function parseSubsecNano(fracStr) {
|
|
3124
3121
|
return parseInt(fracStr.padEnd(9, "0"));
|
|
3125
3122
|
}
|
|
3126
3123
|
|
|
3127
|
-
function parseSign(s) {
|
|
3128
|
-
return s && "+" !== s ? -1 : 1;
|
|
3129
|
-
}
|
|
3130
|
-
|
|
3131
3124
|
function parseInt0(s) {
|
|
3132
3125
|
return void 0 === s ? 0 : parseInt(s);
|
|
3133
3126
|
}
|
|
@@ -3538,10 +3531,6 @@ function validateIsoDateFields(isoInternals) {
|
|
|
3538
3531
|
return constrainIsoDateFields(isoInternals, 1), isoInternals;
|
|
3539
3532
|
}
|
|
3540
3533
|
|
|
3541
|
-
function isIsoDateFieldsValid(isoDate) {
|
|
3542
|
-
return allPropsEqual(calendarDateFieldNamesAsc, isoDate, constrainIsoDateFields(isoDate));
|
|
3543
|
-
}
|
|
3544
|
-
|
|
3545
3534
|
function constrainIsoDateFields(isoDate, overflow) {
|
|
3546
3535
|
const {year: year} = isoDate;
|
|
3547
3536
|
const month = clampProp(isoDate, "month", 1, 12, overflow);
|
|
@@ -3557,7 +3546,7 @@ function computeCalendarDateFields(calendar, isoDate) {
|
|
|
3557
3546
|
}
|
|
3558
3547
|
|
|
3559
3548
|
function computeCalendarMonthCodeParts(calendar, year, month) {
|
|
3560
|
-
return calendar ? calendar.
|
|
3549
|
+
return calendar ? calendar.L(year, month) : computeIsoMonthCodeParts(month);
|
|
3561
3550
|
}
|
|
3562
3551
|
|
|
3563
3552
|
function computeCalendarEraFields(calendar, isoDate) {
|
|
@@ -3740,7 +3729,12 @@ const directionMap = {
|
|
|
3740
3729
|
|
|
3741
3730
|
function coerceRoundingIncInteger(options) {
|
|
3742
3731
|
const roundingInc = options.roundingIncrement;
|
|
3743
|
-
|
|
3732
|
+
if (void 0 === roundingInc) {
|
|
3733
|
+
return 1;
|
|
3734
|
+
}
|
|
3735
|
+
const integer = toIntegerWithTrunc(roundingInc, "roundingIncrement");
|
|
3736
|
+
return (integer < 1 || integer > 10 ** 9) && throwRangeError(invalidEntity("roundingIncrement", integer)),
|
|
3737
|
+
integer;
|
|
3744
3738
|
}
|
|
3745
3739
|
|
|
3746
3740
|
function coerceFractionalSecondDigits(options) {
|
|
@@ -3813,10 +3807,10 @@ function normalizeOptionsOrString(options, optionName) {
|
|
|
3813
3807
|
function validateRoundingInc(roundingInc, smallestUnit, allowManyLargeUnits, solarMode) {
|
|
3814
3808
|
const upUnitNano = solarMode ? nanoInUtcDay : unitNanoMap[smallestUnit + 1];
|
|
3815
3809
|
if (upUnitNano) {
|
|
3816
|
-
const
|
|
3817
|
-
upUnitNano %
|
|
3810
|
+
const incNano = roundingInc * unitNanoMap[smallestUnit];
|
|
3811
|
+
(upUnitNano % incNano || !solarMode && incNano === upUnitNano) && throwRangeError(invalidEntity("roundingIncrement", roundingInc));
|
|
3818
3812
|
} else {
|
|
3819
|
-
roundingInc
|
|
3813
|
+
!allowManyLargeUnits && roundingInc > 1 && throwRangeError(invalidEntity("roundingIncrement", roundingInc));
|
|
3820
3814
|
}
|
|
3821
3815
|
return roundingInc;
|
|
3822
3816
|
}
|
|
@@ -3862,11 +3856,9 @@ const epochNanoMin = /*@__PURE__*/ BigInt(-1e8) * bigNanoInUtcDay;
|
|
|
3862
3856
|
|
|
3863
3857
|
const plainDateEpochNanoMin = epochNanoMin - bigNanoInUtcDay;
|
|
3864
3858
|
|
|
3865
|
-
const isoYearMonthIndexMin = -3261848;
|
|
3866
|
-
|
|
3867
3859
|
function checkIsoYearMonthInBounds(isoDate) {
|
|
3868
3860
|
const isoYearMonthIndex = 12 * isoDate.year + isoDate.month;
|
|
3869
|
-
return (isoYearMonthIndex <
|
|
3861
|
+
return (isoYearMonthIndex < -3261848 || isoYearMonthIndex > 3309129) && throwRangeError(outOfBoundsDate),
|
|
3870
3862
|
isoDate;
|
|
3871
3863
|
}
|
|
3872
3864
|
|
|
@@ -3895,7 +3887,7 @@ function isoDateTimeAndOffsetToEpochNano(isoDateTime, offsetNano) {
|
|
|
3895
3887
|
}
|
|
3896
3888
|
|
|
3897
3889
|
function roundNumberToInc(num, roundingInc, roundingMode) {
|
|
3898
|
-
return roundWithMode(num / roundingInc, roundingMode) * roundingInc;
|
|
3890
|
+
return roundWithMode(num / roundingInc, roundingMode) * roundingInc || 0;
|
|
3899
3891
|
}
|
|
3900
3892
|
|
|
3901
3893
|
function roundWithMode(num, roundingMode) {
|
|
@@ -3904,16 +3896,16 @@ function roundWithMode(num, roundingMode) {
|
|
|
3904
3896
|
|
|
3905
3897
|
function totalRelativeUnit(wholeValue, sign, endEpochNano, moveValueToEpochNano) {
|
|
3906
3898
|
const unitWindow = clampRelativeUnitValue(wholeValue, sign, moveValueToEpochNano, endEpochNano);
|
|
3907
|
-
return interpolateRelativeUnitWindow(unitWindow, Number(endEpochNano - unitWindow.
|
|
3899
|
+
return interpolateRelativeUnitWindow(unitWindow, Number(endEpochNano - unitWindow.N) / Number(unitWindow.te - unitWindow.N));
|
|
3908
3900
|
}
|
|
3909
3901
|
|
|
3910
3902
|
function roundRelativeUnitWindow(unitWindow, endEpochNano, roundingInc, roundingMode) {
|
|
3911
|
-
return roundNumberToInc(interpolateRelativeUnitWindow(unitWindow, computeEpochNanoFrac(endEpochNano, unitWindow.
|
|
3903
|
+
return roundNumberToInc(interpolateRelativeUnitWindow(unitWindow, computeEpochNanoFrac(endEpochNano, unitWindow.N, unitWindow.te)), roundingInc, roundingMode);
|
|
3912
3904
|
}
|
|
3913
3905
|
|
|
3914
3906
|
function clampRelativeUnitValue(startValue, valueDelta, moveValueToEpochNano, epochNanoProgress) {
|
|
3915
3907
|
let unitWindow = computeRelativeUnitWindow(startValue, valueDelta, moveValueToEpochNano);
|
|
3916
|
-
return ((epochNanoProgress, epochNano0, epochNano1, sign) => sign > 0 ? epochNano0 <= epochNanoProgress && epochNanoProgress <= epochNano1 : epochNano1 <= epochNanoProgress && epochNanoProgress <= epochNano0)(epochNanoProgress, unitWindow.
|
|
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)),
|
|
3917
3909
|
unitWindow;
|
|
3918
3910
|
}
|
|
3919
3911
|
|
|
@@ -3921,14 +3913,14 @@ function computeRelativeUnitWindow(startValue, valueDelta, moveValueToEpochNano)
|
|
|
3921
3913
|
const endValue = startValue + valueDelta;
|
|
3922
3914
|
return {
|
|
3923
3915
|
ve: startValue,
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3916
|
+
pe: endValue,
|
|
3917
|
+
N: moveValueToEpochNano(startValue),
|
|
3918
|
+
te: moveValueToEpochNano(endValue)
|
|
3927
3919
|
};
|
|
3928
3920
|
}
|
|
3929
3921
|
|
|
3930
3922
|
function interpolateRelativeUnitWindow(unitWindow, fraction) {
|
|
3931
|
-
return unitWindow.ve + fraction * (unitWindow.
|
|
3923
|
+
return unitWindow.ve + fraction * (unitWindow.pe - unitWindow.ve);
|
|
3932
3924
|
}
|
|
3933
3925
|
|
|
3934
3926
|
function computeEpochNanoFrac(epochNanoProgress, epochNano0, epochNano1) {
|
|
@@ -4017,7 +4009,7 @@ function roundRelativeDuration(durationFields, endEpochNano, largestUnit, smalle
|
|
|
4017
4009
|
}
|
|
4018
4010
|
|
|
4019
4011
|
function roundDayTimeDurationByInc(durationFields, nanoInc, roundingMode) {
|
|
4020
|
-
const maxUnit = Math.min(getMaxDurationUnit(durationFields), 6);
|
|
4012
|
+
const maxUnit = Math.max(Math.min(getMaxDurationUnit(durationFields), 6), 3);
|
|
4021
4013
|
return nanoToDurationDayTimeFields(roundBigNanoToInc(durationDayTimeToBigNano(durationFields), BigInt(nanoInc), roundingMode), maxUnit);
|
|
4022
4014
|
}
|
|
4023
4015
|
|
|
@@ -4031,17 +4023,27 @@ function roundZonedEpochToTime(slots, smallestUnit, roundingInc, roundingMode) {
|
|
|
4031
4023
|
return slots.epochNanoseconds;
|
|
4032
4024
|
}
|
|
4033
4025
|
const isoDateTime = zonedEpochSlotsToIso(slots);
|
|
4034
|
-
return
|
|
4026
|
+
return getInstantPreferringOffset(slots.timeZone, roundDateTimeToUnit(isoDateTime, smallestUnit, roundingInc, roundingMode), isoDateTime.offsetNanoseconds);
|
|
4027
|
+
}
|
|
4028
|
+
|
|
4029
|
+
function roundDateTimeToUnit(isoDateTime, smallestUnit, roundingInc, roundingMode) {
|
|
4030
|
+
return roundDateTimeToInc(isoDateTime, computeNanoInc(smallestUnit, roundingInc), roundingMode, unitNanoMap[smallestUnit + 1]);
|
|
4031
|
+
}
|
|
4032
|
+
|
|
4033
|
+
function roundTimeToUnit(timeFields, smallestUnit, roundingInc, roundingMode) {
|
|
4034
|
+
return roundTimeToInc(timeFields, computeNanoInc(smallestUnit, roundingInc), roundingMode, unitNanoMap[smallestUnit + 1]);
|
|
4035
4035
|
}
|
|
4036
4036
|
|
|
4037
|
-
function roundDateTimeToInc(isoDateTime, nanoInc, roundingMode) {
|
|
4038
|
-
const [roundedTimeFields, dayDelta] = roundTimeToInc(isoDateTime, nanoInc, roundingMode);
|
|
4037
|
+
function roundDateTimeToInc(isoDateTime, nanoInc, roundingMode, spanNano) {
|
|
4038
|
+
const [roundedTimeFields, dayDelta] = roundTimeToInc(isoDateTime, nanoInc, roundingMode, spanNano);
|
|
4039
4039
|
const roundedIsoDateTime = combineDateAndTime(moveDateByDays(isoDateTime, dayDelta), roundedTimeFields);
|
|
4040
4040
|
return checkIsoDateTimeInBounds(roundedIsoDateTime), roundedIsoDateTime;
|
|
4041
4041
|
}
|
|
4042
4042
|
|
|
4043
|
-
function roundTimeToInc(timeFields, nanoInc, roundingMode) {
|
|
4044
|
-
|
|
4043
|
+
function roundTimeToInc(timeFields, nanoInc, roundingMode, spanNano = nanoInUtcDay) {
|
|
4044
|
+
const timeNano = timeFieldsToNano(timeFields);
|
|
4045
|
+
const remainderNano = timeNano % spanNano;
|
|
4046
|
+
return nanoToTimeAndDay(timeNano - remainderNano + roundNumberToInc(remainderNano, nanoInc, roundingMode));
|
|
4045
4047
|
}
|
|
4046
4048
|
|
|
4047
4049
|
function nudgeRelativeDuration(sign, durationFields, endEpochNano, _largestUnit, smallestUnit, roundingInc, roundingMode, relativeOps) {
|
|
@@ -4055,10 +4057,10 @@ function nudgeRelativeDuration(sign, durationFields, endEpochNano, _largestUnit,
|
|
|
4055
4057
|
const nudgeWindow = clampRelativeUnitValue(truncedVal, roundingInc * sign, value => (baseDurationFields[smallestUnitFieldName] = value,
|
|
4056
4058
|
moveRelativeMarkerToEpochNano(relativeOps, baseDurationFields)), endEpochNano);
|
|
4057
4059
|
const roundedVal = roundRelativeUnitWindow(nudgeWindow, endEpochNano, roundingInc, roundingMode);
|
|
4058
|
-
return baseDurationFields[smallestUnitFieldName] = roundedVal, [ baseDurationFields, roundedVal === nudgeWindow.
|
|
4060
|
+
return baseDurationFields[smallestUnitFieldName] = roundedVal, [ baseDurationFields, roundedVal === nudgeWindow.pe ? nudgeWindow.te : nudgeWindow.N, roundedVal !== truncedVal ];
|
|
4059
4061
|
}
|
|
4060
4062
|
|
|
4061
|
-
function nudgeZonedTimeDuration(sign, durationFields,
|
|
4063
|
+
function nudgeZonedTimeDuration(sign, durationFields, _endEpochNano, _largestUnit, smallestUnit, roundingInc, roundingMode, relativeOps) {
|
|
4062
4064
|
const timeNano = Number(durationTimeToBigNano(durationFields));
|
|
4063
4065
|
const nanoInc = computeNanoInc(smallestUnit, roundingInc);
|
|
4064
4066
|
let roundedTimeNano = roundNumberToInc(timeNano, nanoInc, roundingMode);
|
|
@@ -4066,20 +4068,24 @@ function nudgeZonedTimeDuration(sign, durationFields, endEpochNano, _largestUnit
|
|
|
4066
4068
|
...durationFields,
|
|
4067
4069
|
...durationTimeFieldDefaults
|
|
4068
4070
|
};
|
|
4069
|
-
const
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4071
|
+
const dayEpochNano0 = relativeOps.X(dateDurationFields);
|
|
4072
|
+
const dayEpochNano1 = relativeOps.X({
|
|
4073
|
+
...dateDurationFields,
|
|
4074
|
+
days: dateDurationFields.days + sign
|
|
4075
|
+
});
|
|
4076
|
+
const daySpanNano = Number(dayEpochNano1 - dayEpochNano0);
|
|
4077
|
+
Math.sign(daySpanNano) !== sign && throwRangeError("Out-of-bounds TimeZone gap");
|
|
4078
|
+
const beyondDayNano = roundedTimeNano - daySpanNano;
|
|
4074
4079
|
let dayDelta = 0;
|
|
4075
|
-
|
|
4076
|
-
|
|
4080
|
+
let nudgedEpochNano;
|
|
4081
|
+
beyondDayNano && Math.sign(beyondDayNano) !== sign ? nudgedEpochNano = dayEpochNano0 + BigInt(roundedTimeNano) : (dayDelta += sign,
|
|
4082
|
+
roundedTimeNano = roundNumberToInc(beyondDayNano, nanoInc, roundingMode), nudgedEpochNano = dayEpochNano1 + BigInt(roundedTimeNano));
|
|
4077
4083
|
const durationTimeFields = nanoToDurationTimeFields(roundedTimeNano);
|
|
4078
4084
|
return [ {
|
|
4079
4085
|
...durationFields,
|
|
4080
4086
|
...durationTimeFields,
|
|
4081
4087
|
days: durationFields.days + dayDelta
|
|
4082
|
-
},
|
|
4088
|
+
}, nudgedEpochNano, Boolean(dayDelta) ];
|
|
4083
4089
|
}
|
|
4084
4090
|
|
|
4085
4091
|
function nudgeDayTimeDuration(sign, durationFields, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode) {
|
|
@@ -4116,7 +4122,7 @@ function roundBigNanoToInc(bigNano, bigNanoInc, roundingMode) {
|
|
|
4116
4122
|
function roundBigNanoToDayOriginInc(bigNano, bigNanoInc, roundingMode) {
|
|
4117
4123
|
const [day, timeNano] = divModFloorBigInt(bigNano, bigNanoInUtcDay);
|
|
4118
4124
|
const dayOriginNano = day * bigNanoInUtcDay;
|
|
4119
|
-
return dayOriginNano + roundBigNanoToIncWithTail(timeNano, bigNanoInc, roundingMode,
|
|
4125
|
+
return dayOriginNano + roundBigNanoToIncWithTail(timeNano, bigNanoInc, roundingMode, dayOriginNano / bigNanoInc + timeNano / bigNanoInc & 1n);
|
|
4120
4126
|
}
|
|
4121
4127
|
|
|
4122
4128
|
function roundBigNanoToIncWithTail(bigNano, bigNanoInc, roundingMode, quotientTail) {
|
|
@@ -4147,13 +4153,17 @@ function _zonedEpochSlotsToIso(slots) {
|
|
|
4147
4153
|
};
|
|
4148
4154
|
}
|
|
4149
4155
|
|
|
4156
|
+
function getInstantPreferringOffset(timeZone, isoDateTime, offsetNano) {
|
|
4157
|
+
return getMatchingInstantFor(timeZone, isoDateTime, offsetNano, 2, 0);
|
|
4158
|
+
}
|
|
4159
|
+
|
|
4150
4160
|
function getMatchingInstantFor(timeZone, isoDateTime, offsetNano, offsetDisambig = 0, epochDisambig = 0, epochFuzzy, hasZ) {
|
|
4151
|
-
if (void 0 !== offsetNano && 1 === offsetDisambig
|
|
4152
|
-
return isoDateTimeAndOffsetToEpochNano(isoDateTime, offsetNano);
|
|
4161
|
+
if (hasZ || void 0 !== offsetNano && 1 === offsetDisambig) {
|
|
4162
|
+
return isoDateTimeAndOffsetToEpochNano(isoDateTime, offsetNano || 0);
|
|
4153
4163
|
}
|
|
4154
|
-
|
|
4155
|
-
const possibleEpochNanos = timeZone.R(isoDateTime);
|
|
4164
|
+
const possibleEpochNanos = timeZone.O(isoDateTime);
|
|
4156
4165
|
if (void 0 !== offsetNano && 3 !== offsetDisambig) {
|
|
4166
|
+
checkIsoDateInBounds(isoDateTime, 0);
|
|
4157
4167
|
const matchingEpochNano = ((possibleEpochNanos, isoDateTime, offsetNano, fuzzy) => {
|
|
4158
4168
|
const zonedEpochNano = isoDateTimeToEpochNano(isoDateTime);
|
|
4159
4169
|
fuzzy && (offsetNano = roundToMinute(offsetNano));
|
|
@@ -4169,10 +4179,10 @@ function getMatchingInstantFor(timeZone, isoDateTime, offsetNano, offsetDisambig
|
|
|
4169
4179
|
}
|
|
4170
4180
|
0 === offsetDisambig && throwRangeError("Invalid TimeZone offset");
|
|
4171
4181
|
}
|
|
4172
|
-
return
|
|
4182
|
+
return getSingleInstantFor(timeZone, isoDateTime, epochDisambig, possibleEpochNanos);
|
|
4173
4183
|
}
|
|
4174
4184
|
|
|
4175
|
-
function getSingleInstantFor(timeZone, isoDateTime, disambig = 0, possibleEpochNanos = timeZone.
|
|
4185
|
+
function getSingleInstantFor(timeZone, isoDateTime, disambig = 0, possibleEpochNanos = timeZone.O(isoDateTime)) {
|
|
4176
4186
|
if (1 === possibleEpochNanos.length) {
|
|
4177
4187
|
return possibleEpochNanos[0];
|
|
4178
4188
|
}
|
|
@@ -4186,11 +4196,11 @@ function getSingleInstantFor(timeZone, isoDateTime, disambig = 0, possibleEpochN
|
|
|
4186
4196
|
gapNano))(timeZone.B(zonedEpochNano + bigNanoInUtcDay) - startOffsetNano);
|
|
4187
4197
|
})(timeZone, zonedEpochNano);
|
|
4188
4198
|
const shiftedIsoDateTime = epochNanoToIsoDateTime(zonedEpochNano + BigInt(gapNano * (2 === disambig ? -1 : 1)));
|
|
4189
|
-
return (possibleEpochNanos = timeZone.
|
|
4199
|
+
return (possibleEpochNanos = timeZone.O(shiftedIsoDateTime))[2 === disambig ? 0 : possibleEpochNanos.length - 1];
|
|
4190
4200
|
}
|
|
4191
4201
|
|
|
4192
4202
|
function getStartOfDayInstantFor(timeZone, isoDateTime) {
|
|
4193
|
-
const possibleEpochNanos = timeZone.
|
|
4203
|
+
const possibleEpochNanos = timeZone.O(isoDateTime);
|
|
4194
4204
|
if (possibleEpochNanos.length) {
|
|
4195
4205
|
return possibleEpochNanos[0];
|
|
4196
4206
|
}
|
|
@@ -4284,8 +4294,12 @@ function addCalendarMonths(calendar, year, month, monthDelta) {
|
|
|
4284
4294
|
function resolveMonthInMovedYear(calendar, monthCodeNumber, isLeapMonth, targetLeapMonth, overflow) {
|
|
4285
4295
|
if (isLeapMonth) {
|
|
4286
4296
|
const leapMonthMeta = calendar ? calendar.l : void 0;
|
|
4287
|
-
|
|
4288
|
-
|
|
4297
|
+
if (void 0 !== targetLeapMonth && (leapMonthMeta < 0 || targetLeapMonth === monthCodeNumber + 1)) {
|
|
4298
|
+
return targetLeapMonth;
|
|
4299
|
+
}
|
|
4300
|
+
if (1 === overflow && throwRangeError(invalidLeapMonth), leapMonthMeta < 0) {
|
|
4301
|
+
return -leapMonthMeta;
|
|
4302
|
+
}
|
|
4289
4303
|
}
|
|
4290
4304
|
return monthCodeNumberToMonth(monthCodeNumber, 0, targetLeapMonth);
|
|
4291
4305
|
}
|
|
@@ -4321,12 +4335,12 @@ function getZonedTimeZoneId(slots) {
|
|
|
4321
4335
|
|
|
4322
4336
|
function diffZonedDateTimesRounded(calendar, startZoned, endZoned, largestUnit, smallestUnit, roundingInc, roundingMode) {
|
|
4323
4337
|
return largestUnit < 6 ? diffEpochNanosRounded(startZoned.epochNanoseconds, endZoned.epochNanoseconds, largestUnit, smallestUnit, roundingInc, roundingMode) : ((calendar, startZoned, endZoned, largestUnit, smallestUnit, roundingInc, roundingMode) => {
|
|
4338
|
+
const timeZone = getCommonTimeZone(startZoned.timeZone, endZoned.timeZone);
|
|
4324
4339
|
const endEpochNano = endZoned.epochNanoseconds;
|
|
4325
4340
|
if (endEpochNano === startZoned.epochNanoseconds) {
|
|
4326
4341
|
return durationFieldDefaults;
|
|
4327
4342
|
}
|
|
4328
4343
|
let durationFields;
|
|
4329
|
-
const timeZone = getCommonTimeZone(startZoned.timeZone, endZoned.timeZone);
|
|
4330
4344
|
return durationFields = diffZonedEpochsExact(timeZone, calendar, startZoned, endZoned, largestUnit),
|
|
4331
4345
|
durationFields = roundRelativeDuration(durationFields, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode, createZonedRelativeOps(calendar, timeZone, startZoned), 1),
|
|
4332
4346
|
durationFields;
|
|
@@ -4344,7 +4358,7 @@ function diffDateTimesRounded(calendar, startIsoDateTime, endIsoDateTime, larges
|
|
|
4344
4358
|
return durationFields = diffDateTimesBig(calendar, startIsoDateTime, endIsoDateTime, sign, largestUnit),
|
|
4345
4359
|
durationFields = roundRelativeDuration(durationFields, endEpochNano, largestUnit, smallestUnit, roundingInc, roundingMode, ((calendar, origin) => ({
|
|
4346
4360
|
ne: isoDateTimeToEpochNano(origin),
|
|
4347
|
-
|
|
4361
|
+
X: duration => isoDateTimeToEpochNano(combineDateAndTime(moveDate(calendar, origin, duration), origin))
|
|
4348
4362
|
}))(calendar, startIsoDateTime)), durationFields;
|
|
4349
4363
|
})(calendar, startIsoDateTime, endIsoDateTime, largestUnit, smallestUnit, roundingInc, roundingMode);
|
|
4350
4364
|
}
|
|
@@ -4436,7 +4450,7 @@ function prepareZonedEpochDiff(timeZone, startZoned, endZoned, sign) {
|
|
|
4436
4450
|
let dayCorrection = 0;
|
|
4437
4451
|
const timeDiffNano = timeFieldsToNano(endIsoDate) - timeFieldsToNano(startIsoDate);
|
|
4438
4452
|
Math.sign(timeDiffNano) === -sign && dayCorrection++;
|
|
4439
|
-
const maxDayCorrection =
|
|
4453
|
+
const maxDayCorrection = sign > 0 ? 2 : 1;
|
|
4440
4454
|
for (;;dayCorrection++) {
|
|
4441
4455
|
const midIsoDate = moveDateByDays(endIsoDate, dayCorrection * -sign);
|
|
4442
4456
|
const midEpochNano = getSingleInstantFor(timeZone, combineDateAndTime(midIsoDate, startIsoDate));
|
|
@@ -4544,21 +4558,21 @@ function moveRelativeEndpointToEpochNano(relativeToSlots, durationFields) {
|
|
|
4544
4558
|
}
|
|
4545
4559
|
|
|
4546
4560
|
function moveRelativeMarkerToEpochNano(relativeOps, dateDuration) {
|
|
4547
|
-
return durationHasDateParts(dateDuration) ? relativeOps.
|
|
4561
|
+
return durationHasDateParts(dateDuration) ? relativeOps.X(dateDuration) : relativeOps.ne;
|
|
4548
4562
|
}
|
|
4549
4563
|
|
|
4550
4564
|
function createZonedRelativeOps(calendar, timeZone, slots) {
|
|
4551
4565
|
const origin = zonedEpochSlotsToIso(slots);
|
|
4552
4566
|
return {
|
|
4553
4567
|
ne: slots.epochNanoseconds,
|
|
4554
|
-
|
|
4568
|
+
X: duration => getSingleInstantFor(timeZone, combineDateAndTime(moveDate(calendar, origin, duration), origin))
|
|
4555
4569
|
};
|
|
4556
4570
|
}
|
|
4557
4571
|
|
|
4558
4572
|
function createDateRelativeOps(calendar, origin) {
|
|
4559
4573
|
return {
|
|
4560
4574
|
ne: isoDateToEpochNano(origin),
|
|
4561
|
-
|
|
4575
|
+
X: duration => isoDateToEpochNano(moveDate(calendar, origin, duration))
|
|
4562
4576
|
};
|
|
4563
4577
|
}
|
|
4564
4578
|
|
|
@@ -4821,7 +4835,7 @@ function resolveTimeFields(fields, overflow) {
|
|
|
4821
4835
|
}), overflow);
|
|
4822
4836
|
}
|
|
4823
4837
|
|
|
4824
|
-
const offsetRegExp =
|
|
4838
|
+
const offsetRegExp = /^([+-])([01]\d|2[0-3])(?:(:?)([0-5]\d)(?:\3([0-5]\d)(?:[.,](\d{1,9}))?)?)?$/;
|
|
4825
4839
|
|
|
4826
4840
|
function parseOffsetNano(s) {
|
|
4827
4841
|
const offsetNano = parseOffsetNanoMaybe(s);
|
|
@@ -4830,21 +4844,8 @@ function parseOffsetNano(s) {
|
|
|
4830
4844
|
|
|
4831
4845
|
function parseOffsetNanoMaybe(s, onlyHourMinute) {
|
|
4832
4846
|
const parts = offsetRegExp.exec(s);
|
|
4833
|
-
if (parts
|
|
4834
|
-
|
|
4835
|
-
const fractionIndex = s.search(/[.,]/);
|
|
4836
|
-
const main = fractionIndex < 0 ? s : s.slice(0, fractionIndex);
|
|
4837
|
-
const parts = main.split(":");
|
|
4838
|
-
return 1 === parts.length ? /^(?:\d{2}|\d{4}|\d{6})$/i.test(main) : (2 === parts.length || 3 === parts.length) && parts.every(part => 2 === part.length && /^\d{2}$/i.test(part));
|
|
4839
|
-
})(s.slice(1)))(parts[0])) {
|
|
4840
|
-
return ((parts, onlyHourMinute) => {
|
|
4841
|
-
const firstSubMinutePart = parts[4] || parts[5];
|
|
4842
|
-
onlyHourMinute && firstSubMinutePart && throwRangeError(invalidSubstring(firstSubMinutePart));
|
|
4843
|
-
const offsetNanoPos = parseInt0(parts[2]) * nanoInHour + parseInt0(parts[3]) * nanoInMinute + parseInt0(parts[4]) * nanoInSec + parseSubsecNano(parts[5] || "");
|
|
4844
|
-
return offsetNano = offsetNanoPos * parseSign(parts[1]), Math.abs(offsetNano) >= nanoInUtcDay && throwRangeError("Out-of-bounds offset"),
|
|
4845
|
-
offsetNano;
|
|
4846
|
-
var offsetNano;
|
|
4847
|
-
})(parts, onlyHourMinute);
|
|
4847
|
+
if (parts) {
|
|
4848
|
+
return onlyHourMinute && parts[5] && throwRangeError(failedParse(s)), (s => s && "+" !== s ? -1 : 1)(parts[1]) * (parseInt(parts[2]) * nanoInHour + parseInt0(parts[4]) * nanoInMinute + parseInt0(parts[5]) * nanoInSec + parseSubsecNano(parts[6] || ""));
|
|
4848
4849
|
}
|
|
4849
4850
|
}
|
|
4850
4851
|
|
|
@@ -4883,7 +4884,7 @@ function readAndRefineBagFields(bag, validFieldNames, fieldRefiners, requiredFie
|
|
|
4883
4884
|
requiredFieldNames && requiredFieldNames.includes(fieldName) && throwTypeError(missingField(fieldName));
|
|
4884
4885
|
}
|
|
4885
4886
|
}
|
|
4886
|
-
return disallowEmpty && !anyMatching && throwTypeError(
|
|
4887
|
+
return disallowEmpty && !anyMatching && throwTypeError("No valid fields: " + validFieldNames.join()),
|
|
4887
4888
|
res;
|
|
4888
4889
|
}
|
|
4889
4890
|
|
|
@@ -4962,8 +4963,8 @@ function createYearMonthFromCalendarParts(calendar, year, month) {
|
|
|
4962
4963
|
|
|
4963
4964
|
function createMonthDayFromMonthCodeParts(calendar, monthCodeNumber, isLeapMonthArg, day, requestedDay, overflow) {
|
|
4964
4965
|
let isLeapMonth = isLeapMonthArg;
|
|
4965
|
-
isLeapMonth && ((calendar && calendar.
|
|
4966
|
-
isLeapMonth = 0, day = constrainToRange(requestedDay, 1, (calendar && calendar.
|
|
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));
|
|
4967
4968
|
let res = calendar ? calendar.u(monthCodeNumber, Boolean(isLeapMonth), day) : computeIsoYearMonthFieldsForMonthDay(monthCodeNumber, Boolean(isLeapMonth));
|
|
4968
4969
|
for (;!res && 0 === overflow && day > 1; ) {
|
|
4969
4970
|
day--, res = calendar ? calendar.u(monthCodeNumber, Boolean(isLeapMonth), day) : computeIsoYearMonthFieldsForMonthDay(monthCodeNumber, Boolean(isLeapMonth));
|
|
@@ -4992,7 +4993,7 @@ function formatEpochMilliToPartsRecord(intlFormat, epochMilli) {
|
|
|
4992
4993
|
}
|
|
4993
4994
|
|
|
4994
4995
|
const timeZonePeriodDaysByName = {
|
|
4995
|
-
"El_Aaiun":
|
|
4996
|
+
"El_Aaiun": 16,
|
|
4996
4997
|
"Tucuman": 12,
|
|
4997
4998
|
"Tirane": 11,
|
|
4998
4999
|
"Riga": 10,
|
|
@@ -5009,7 +5010,7 @@ const timeZonePeriodDaysByName = {
|
|
|
5009
5010
|
"DeNoronha": 6
|
|
5010
5011
|
};
|
|
5011
5012
|
|
|
5012
|
-
const minPossibleTransitionSec = -
|
|
5013
|
+
const minPossibleTransitionSec = -4e9;
|
|
5013
5014
|
|
|
5014
5015
|
function refineTimeDisplayTuple(options, maxSmallestUnit = 4) {
|
|
5015
5016
|
const subsecDigits = coerceFractionalSecondDigits(options);
|
|
@@ -5092,10 +5093,10 @@ function formatPlainTimeIso(slots, options) {
|
|
|
5092
5093
|
|
|
5093
5094
|
function formatDurationIso(slots, options) {
|
|
5094
5095
|
const [roundingMode, nanoInc, subsecDigits] = refineTimeDisplayOptions(options, 3);
|
|
5095
|
-
return nanoInc > 1 &&
|
|
5096
|
+
return nanoInc > 1 && ((slots = {
|
|
5096
5097
|
...slots,
|
|
5097
5098
|
...roundDayTimeDurationByInc(slots, nanoInc, roundingMode)
|
|
5098
|
-
}), formatDurationSlots(slots, subsecDigits);
|
|
5099
|
+
}).sign = computeDurationSign(slots), validateDurationFields(slots)), formatDurationSlots(slots, subsecDigits);
|
|
5099
5100
|
}
|
|
5100
5101
|
|
|
5101
5102
|
function formatDurationSlots(durationSlots, subsecDigits) {
|
|
@@ -5206,7 +5207,7 @@ function resolveTimeZoneId(rawId) {
|
|
|
5206
5207
|
return resolveTimeZoneRecord(rawId).id;
|
|
5207
5208
|
}
|
|
5208
5209
|
|
|
5209
|
-
|
|
5210
|
+
const resolveTimeZoneRecord = /*@__PURE__*/ memoize(rawId => {
|
|
5210
5211
|
const upperRawId = rawId.toUpperCase();
|
|
5211
5212
|
const offsetRecord = (upperRawId => {
|
|
5212
5213
|
const offsetNano = parseOffsetNanoMaybe(upperRawId, 1);
|
|
@@ -5227,7 +5228,7 @@ function resolveTimeZoneRecord(rawId) {
|
|
|
5227
5228
|
const normId = "UTC" === upperRawId ? "UTC" : (rawId => (badCharactersRegExp.test(rawId) && throwRangeError(invalidTimeZone(rawId)),
|
|
5228
5229
|
icuRegExp.test(rawId) && throwRangeError("Forbidden ICU TimeZone"), rawId.toLowerCase().split("/").map((part, partI) => (part.length <= 3 || /\d/.test(part)) && !/etc|yap/.test(part) ? part.toUpperCase() : part.replace(/baja|dumont|[a-z]+/g, (a, i) => a.length <= 2 && !partI || "in" === a || "chat" === a ? a.toUpperCase() : a.length > 2 || !i ? capitalize(a).replace(/island|noronha|murdo|rivadavia|urville/, capitalize) : a)).join("/")))(rawId);
|
|
5229
5230
|
return queryNamedTimeZoneRecord(normId);
|
|
5230
|
-
}
|
|
5231
|
+
});
|
|
5231
5232
|
|
|
5232
5233
|
const queryNamedTimeZoneRecord = /*@__PURE__*/ memoize(normId => {
|
|
5233
5234
|
if ("UTC" === normId) {
|
|
@@ -5237,8 +5238,18 @@ const queryNamedTimeZoneRecord = /*@__PURE__*/ memoize(normId => {
|
|
|
5237
5238
|
m: normId
|
|
5238
5239
|
};
|
|
5239
5240
|
}
|
|
5240
|
-
const upperNormId = normId.toUpperCase()
|
|
5241
|
-
|
|
5241
|
+
const format = (upperNormId = normId.toUpperCase(), new RawDateTimeFormat("en-u-hc-h23", {
|
|
5242
|
+
calendar: "iso8601",
|
|
5243
|
+
timeZone: upperNormId,
|
|
5244
|
+
era: "short",
|
|
5245
|
+
year: "numeric",
|
|
5246
|
+
month: "numeric",
|
|
5247
|
+
day: "numeric",
|
|
5248
|
+
hour: "numeric",
|
|
5249
|
+
minute: "numeric",
|
|
5250
|
+
second: "numeric"
|
|
5251
|
+
}));
|
|
5252
|
+
var upperNormId;
|
|
5242
5253
|
return {
|
|
5243
5254
|
kind: "named",
|
|
5244
5255
|
id: normId,
|
|
@@ -5247,18 +5258,6 @@ const queryNamedTimeZoneRecord = /*@__PURE__*/ memoize(normId => {
|
|
|
5247
5258
|
};
|
|
5248
5259
|
});
|
|
5249
5260
|
|
|
5250
|
-
const queryTimeZoneIntlFormat = /*@__PURE__*/ memoize(upperNormId => new RawDateTimeFormat("en-u-hc-h23", {
|
|
5251
|
-
calendar: "iso8601",
|
|
5252
|
-
timeZone: upperNormId,
|
|
5253
|
-
era: "short",
|
|
5254
|
-
year: "numeric",
|
|
5255
|
-
month: "numeric",
|
|
5256
|
-
day: "numeric",
|
|
5257
|
-
hour: "numeric",
|
|
5258
|
-
minute: "numeric",
|
|
5259
|
-
second: "numeric"
|
|
5260
|
-
}));
|
|
5261
|
-
|
|
5262
5261
|
function queryTimeZone(rawTimeZoneId) {
|
|
5263
5262
|
const record = resolveTimeZoneRecord(rawTimeZoneId);
|
|
5264
5263
|
return queryTimeZoneRecord(record.id, record);
|
|
@@ -5273,7 +5272,7 @@ class FixedTimeZone {
|
|
|
5273
5272
|
B() {
|
|
5274
5273
|
return this.Z;
|
|
5275
5274
|
}
|
|
5276
|
-
|
|
5275
|
+
O(isoDateTime) {
|
|
5277
5276
|
return [ isoDateTimeAndOffsetToEpochNano(isoDateTime, this.Z) ];
|
|
5278
5277
|
}
|
|
5279
5278
|
C() {}
|
|
@@ -5281,7 +5280,7 @@ class FixedTimeZone {
|
|
|
5281
5280
|
|
|
5282
5281
|
class IntlTimeZone {
|
|
5283
5282
|
constructor(id, compareKey, format) {
|
|
5284
|
-
this.id = id, this.m = compareKey, this.
|
|
5283
|
+
this.id = id, this.m = compareKey, this.me = ((computeOffsetSec, periodDays) => {
|
|
5285
5284
|
const getSample = memoize(computeOffsetSec);
|
|
5286
5285
|
const getSplit = memoize(createSplitTuple);
|
|
5287
5286
|
const periodSec = 86400 * periodDays;
|
|
@@ -5293,6 +5292,26 @@ class IntlTimeZone {
|
|
|
5293
5292
|
const endOffsetSec = getSample(clampedEndEpochSec);
|
|
5294
5293
|
return startOffsetSec === endOffsetSec ? startOffsetSec : pinch(getSplit(clampedStartEpochSec, clampedEndEpochSec), startOffsetSec, endOffsetSec, epochSec);
|
|
5295
5294
|
}
|
|
5295
|
+
function searchTransition(searchEpochSec, direction, searchLimit, epochSec = searchEpochSec) {
|
|
5296
|
+
let [startEpochSec, endEpochSec] = computePeriod(searchEpochSec, periodSec);
|
|
5297
|
+
const inc = periodSec * direction;
|
|
5298
|
+
const inBounds = () => direction < 0 ? endEpochSec > searchLimit : startEpochSec < searchLimit;
|
|
5299
|
+
for (;inBounds(); ) {
|
|
5300
|
+
const clampedStartEpochSec = clampIntlSampleEpochSec(startEpochSec);
|
|
5301
|
+
const clampedEndEpochSec = clampIntlSampleEpochSec(endEpochSec);
|
|
5302
|
+
const startOffsetSec = getSample(clampedStartEpochSec);
|
|
5303
|
+
const endOffsetSec = getSample(clampedEndEpochSec);
|
|
5304
|
+
if (startOffsetSec !== endOffsetSec) {
|
|
5305
|
+
const split = getSplit(clampedStartEpochSec, clampedEndEpochSec);
|
|
5306
|
+
pinch(split, startOffsetSec, endOffsetSec);
|
|
5307
|
+
const transitionEpochSec = split[0];
|
|
5308
|
+
if ((compareNumbers(transitionEpochSec, epochSec) || 1) === direction) {
|
|
5309
|
+
return transitionEpochSec;
|
|
5310
|
+
}
|
|
5311
|
+
}
|
|
5312
|
+
startEpochSec += inc, endEpochSec += inc;
|
|
5313
|
+
}
|
|
5314
|
+
}
|
|
5296
5315
|
function pinch(split, startOffsetSec, endOffsetSec, forEpochSec) {
|
|
5297
5316
|
let offsetSec;
|
|
5298
5317
|
let splitDurSec;
|
|
@@ -5315,38 +5334,15 @@ class IntlTimeZone {
|
|
|
5315
5334
|
return narrowOffsetSec0 === getOffsetSec(wideUtcEpochSec1) ? [ zonedEpochSec - narrowOffsetSec0 ] : wideOffsetSec0 > wideOffsetSec1 ? [ wideUtcEpochSec0, wideUtcEpochSec1 ] : [];
|
|
5316
5335
|
},
|
|
5317
5336
|
ze: getOffsetSec,
|
|
5318
|
-
C
|
|
5319
|
-
if (direction > 0 && epochSec >= 864e10) {
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
if (epochSec <= minPossibleTransitionSec) {
|
|
5324
|
-
return;
|
|
5325
|
-
}
|
|
5326
|
-
const lookaheadEpochSec = getCurrentEpochSec() + 94867200;
|
|
5327
|
-
if (epochSec > lookaheadEpochSec) {
|
|
5328
|
-
return getTransition(lookaheadEpochSec, -1);
|
|
5329
|
-
}
|
|
5330
|
-
}
|
|
5331
|
-
const searchEpochSec = direction > 0 ? Math.max(epochSec, minPossibleTransitionSec) : epochSec;
|
|
5332
|
-
let [startEpochSec, endEpochSec] = computePeriod(searchEpochSec, periodSec);
|
|
5333
|
-
const inc = periodSec * direction;
|
|
5334
|
-
const searchLimit = direction > 0 ? Math.max(epochSec, getCurrentEpochSec()) + 94867200 : minPossibleTransitionSec;
|
|
5335
|
-
const inBounds = () => direction < 0 ? endEpochSec > searchLimit : startEpochSec < searchLimit;
|
|
5336
|
-
for (;inBounds(); ) {
|
|
5337
|
-
const clampedStartEpochSec = clampIntlSampleEpochSec(startEpochSec);
|
|
5338
|
-
const clampedEndEpochSec = clampIntlSampleEpochSec(endEpochSec);
|
|
5339
|
-
const startOffsetSec = getSample(clampedStartEpochSec);
|
|
5340
|
-
const endOffsetSec = getSample(clampedEndEpochSec);
|
|
5341
|
-
if (startOffsetSec !== endOffsetSec) {
|
|
5342
|
-
const split = getSplit(clampedStartEpochSec, clampedEndEpochSec);
|
|
5343
|
-
pinch(split, startOffsetSec, endOffsetSec);
|
|
5344
|
-
const transitionEpochSec = split[0];
|
|
5345
|
-
if ((compareNumbers(transitionEpochSec, epochSec) || 1) === direction) {
|
|
5346
|
-
return transitionEpochSec;
|
|
5337
|
+
C(epochSec, direction) {
|
|
5338
|
+
if (!(direction > 0 && epochSec >= 864e10)) {
|
|
5339
|
+
if (direction < 0) {
|
|
5340
|
+
if (epochSec <= minPossibleTransitionSec) {
|
|
5341
|
+
return;
|
|
5347
5342
|
}
|
|
5343
|
+
return epochSec > 4e9 ? searchTransition(epochSec, -1, epochSec - 94867200) ?? searchTransition(4e9, -1, minPossibleTransitionSec) : searchTransition(epochSec, -1, minPossibleTransitionSec);
|
|
5348
5344
|
}
|
|
5349
|
-
|
|
5345
|
+
return searchTransition(Math.max(epochSec, minPossibleTransitionSec) - 1, 1, Math.max(epochSec, Math.floor(Date.now() / 1e3)) + 94867200, epochSec);
|
|
5350
5346
|
}
|
|
5351
5347
|
}
|
|
5352
5348
|
};
|
|
@@ -5362,30 +5358,26 @@ class IntlTimeZone {
|
|
|
5362
5358
|
})(intlParts), parseInt(intlParts.month), parseInt(intlParts.day)) + 3600 * parseInt(intlParts.hour) + 60 * parseInt(intlParts.minute) + parseInt(intlParts.second) - epochSec;
|
|
5363
5359
|
})(format), (timeZoneId => {
|
|
5364
5360
|
const timeZoneName = timeZoneId.split("/").pop();
|
|
5365
|
-
return timeZonePeriodDaysByName[timeZoneName] ||
|
|
5361
|
+
return timeZonePeriodDaysByName[timeZoneName] || 19;
|
|
5366
5362
|
})(id));
|
|
5367
5363
|
}
|
|
5368
5364
|
B(epochNano) {
|
|
5369
|
-
return this.
|
|
5365
|
+
return this.me.ze((epochNano => epochNanoToSecMod(epochNano)[0])(epochNano)) * nanoInSec;
|
|
5370
5366
|
}
|
|
5371
|
-
|
|
5367
|
+
O(isoDateTime) {
|
|
5372
5368
|
const zonedEpochSec = 86400 * isoDateToEpochDays(isoDateTime) + timeFieldsToSec(isoDateTime);
|
|
5373
5369
|
const subsecNano = timeFieldsToSubsecNano(isoDateTime);
|
|
5374
|
-
return this.
|
|
5370
|
+
return this.me.Ae(zonedEpochSec).map(epochSec => checkEpochNanoInBounds(BigInt(epochSec) * bigNanoInSec + BigInt(subsecNano)));
|
|
5375
5371
|
}
|
|
5376
5372
|
C(epochNano, direction) {
|
|
5377
5373
|
const [epochSec, subsecNano] = epochNanoToSecMod(epochNano);
|
|
5378
|
-
const resEpochSec = this.
|
|
5374
|
+
const resEpochSec = this.me.C(epochSec + (direction > 0 || subsecNano ? 1 : 0), direction);
|
|
5379
5375
|
if (void 0 !== resEpochSec) {
|
|
5380
5376
|
return BigInt(resEpochSec) * bigNanoInSec;
|
|
5381
5377
|
}
|
|
5382
5378
|
}
|
|
5383
5379
|
}
|
|
5384
5380
|
|
|
5385
|
-
function getCurrentEpochSec() {
|
|
5386
|
-
return Math.floor(Date.now() / 1e3);
|
|
5387
|
-
}
|
|
5388
|
-
|
|
5389
5381
|
function createSplitTuple(startEpochSec, endEpochSec) {
|
|
5390
5382
|
return [ startEpochSec, endEpochSec ];
|
|
5391
5383
|
}
|
|
@@ -5472,15 +5464,13 @@ function throwFailedParse(s) {
|
|
|
5472
5464
|
function parseInstant(s) {
|
|
5473
5465
|
const organized = parseDateTimeLike(s = requireString(toPrimitiveWithStringHint(s)));
|
|
5474
5466
|
let offsetNano;
|
|
5475
|
-
return organized || throwFailedParse(s), organized.
|
|
5476
|
-
organized.timeZoneId && parseOffsetNanoMaybe(organized.timeZoneId, 1), validateIsoDateTimeFields(organized),
|
|
5467
|
+
return organized || throwFailedParse(s), organized.I ? offsetNano = 0 : organized.offset ? offsetNano = parseOffsetNano(organized.offset) : throwFailedParse(s),
|
|
5477
5468
|
createEpochNanoSlots(isoDateTimeAndOffsetToEpochNano(organized, offsetNano));
|
|
5478
5469
|
}
|
|
5479
5470
|
|
|
5480
5471
|
function parseRelativeToSlots(s, resolveCalendar) {
|
|
5481
5472
|
const organized = parseDateTimeLike(requireString(s));
|
|
5482
|
-
return organized
|
|
5483
|
-
finalizeDate(organized, resolveCalendar));
|
|
5473
|
+
return organized && organized.timeZoneId ? finalizeZonedDateTime(organized, resolveCalendar, void 0) : finalizeDate(parsePlainDateLike(s), resolveCalendar);
|
|
5484
5474
|
}
|
|
5485
5475
|
|
|
5486
5476
|
function parseZonedDateTime(s, resolveCalendar, options) {
|
|
@@ -5489,140 +5479,84 @@ function parseZonedDateTime(s, resolveCalendar, options) {
|
|
|
5489
5479
|
}
|
|
5490
5480
|
|
|
5491
5481
|
function parsePlainDateTime(s, resolveCalendar) {
|
|
5492
|
-
const organized =
|
|
5493
|
-
return organized
|
|
5482
|
+
const organized = parsePlainDateLike(s);
|
|
5483
|
+
return checkIsoDateTimeInBounds(organized), {
|
|
5484
|
+
...combineDateAndTime(organized, organized),
|
|
5485
|
+
calendar: resolveCalendar(organized.calendarId)
|
|
5486
|
+
};
|
|
5494
5487
|
}
|
|
5495
5488
|
|
|
5496
5489
|
function parsePlainDate(s, resolveCalendar) {
|
|
5497
|
-
|
|
5498
|
-
return createDateSlots(slots, slots.calendar);
|
|
5490
|
+
return finalizeDate(parsePlainDateLike(s), resolveCalendar);
|
|
5499
5491
|
}
|
|
5500
5492
|
|
|
5501
5493
|
function parsePlainYearMonth(s, resolveCalendar) {
|
|
5502
|
-
const organized = parseYearMonthOnly(requireString(s));
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
}
|
|
5506
|
-
const dateSlots = finalizeDateLike(parsePlainDateLike(s), projectIsoYearMonthDate, resolveCalendar);
|
|
5507
|
-
const {calendar: calendar} = dateSlots;
|
|
5508
|
-
return createDateSlots(moveToStartOfMonth(calendar, dateSlots), calendar);
|
|
5509
|
-
}
|
|
5510
|
-
|
|
5511
|
-
function requireIsoCalendar(organized) {
|
|
5512
|
-
"iso8601" !== organized.calendarId && throwRangeError(invalidSubstring(organized.calendarId));
|
|
5494
|
+
const organized = parseYearMonthOnly(requireString(s)) || parsePlainDateLike(s);
|
|
5495
|
+
const calendar = resolveCalendar(organized.calendarId);
|
|
5496
|
+
return createDateSlots(checkIsoYearMonthInBounds(moveToStartOfMonth(calendar, checkIsoYearMonthInBounds(organized))), calendar);
|
|
5513
5497
|
}
|
|
5514
5498
|
|
|
5515
5499
|
function parsePlainMonthDay(s, resolveCalendar) {
|
|
5516
|
-
const organized = parseMonthDayOnly(requireString(s));
|
|
5517
|
-
if (organized) {
|
|
5518
|
-
return
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5500
|
+
const organized = parseMonthDayOnly(requireString(s)) || parsePlainDateLike(s);
|
|
5501
|
+
if ("iso8601" === organized.calendarId) {
|
|
5502
|
+
return createDateSlots({
|
|
5503
|
+
...organized,
|
|
5504
|
+
year: 1972
|
|
5505
|
+
}, resolveCalendar("iso8601"));
|
|
5506
|
+
}
|
|
5507
|
+
const {calendar: calendar} = finalizeDate(organized, resolveCalendar);
|
|
5508
|
+
const {year: origYear, month: origMonth, day: day} = computeCalendarDateFields(calendar, organized);
|
|
5523
5509
|
const [monthCodeNumber, isLeapMonth] = computeCalendarMonthCodeParts(calendar, origYear, origMonth);
|
|
5524
|
-
const
|
|
5525
|
-
|
|
5526
|
-
return yearMonthFields || throwRangeError("Cannot guess year"), yearMonthFields;
|
|
5527
|
-
})(calendar, monthCodeNumber, isLeapMonth, day);
|
|
5528
|
-
return createDateSlots(checkIsoDateInBounds(computeCalendarIsoFieldsFromParts(calendar, year, month, day)), calendar);
|
|
5510
|
+
const yearMonthFields = calendar ? calendar.u(monthCodeNumber, isLeapMonth, day) : computeIsoYearMonthFieldsForMonthDay(monthCodeNumber, isLeapMonth);
|
|
5511
|
+
return yearMonthFields || throwRangeError("Cannot guess year"), createDateSlots(checkIsoDateInBounds(computeCalendarIsoFieldsFromParts(calendar, yearMonthFields.year, yearMonthFields.month, day)), calendar);
|
|
5529
5512
|
}
|
|
5530
5513
|
|
|
5531
5514
|
function parsePlainTime(s) {
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
})(s = requireString(s));
|
|
5536
|
-
if (!organized) {
|
|
5537
|
-
const dateTime = parseDateTimeLike(s);
|
|
5538
|
-
dateTime && dateTime.te || throwFailedParse(s), dateTime.F && throwRangeError(invalidSubstring("Z")),
|
|
5539
|
-
requireIsoCalendar(dateTime), organized = dateTime;
|
|
5540
|
-
}
|
|
5541
|
-
let altParsed;
|
|
5542
|
-
return (altParsed = parseYearMonthOnly(s)) && isIsoDateFieldsValid(altParsed) && throwFailedParse(s),
|
|
5543
|
-
(altParsed = parseMonthDayOnly(s)) && isIsoDateFieldsValid(altParsed) && throwFailedParse(s),
|
|
5544
|
-
createTimeSlots(validateTimeFields(organized));
|
|
5515
|
+
const organized = parseDateTimeLike(s = requireString(s)) || parseTimeOnly(s);
|
|
5516
|
+
return (!organized || !organized.qe || organized.I || parseYearMonthOnly(s) || parseMonthDayOnly(s)) && throwFailedParse(s),
|
|
5517
|
+
createTimeSlots(organized);
|
|
5545
5518
|
}
|
|
5546
5519
|
|
|
5547
5520
|
function parseDuration(s) {
|
|
5548
5521
|
const parts = durationRegExp.exec(requireString(s));
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
};
|
|
5563
|
-
return hasAny || throwRangeError(noValidFields(durationFieldNamesAsc)), parseSign(parts[1]) < 0 && (durationFields = negateDurationFields(durationFields)),
|
|
5564
|
-
durationFields;
|
|
5565
|
-
function parseUnit(wholeStr, fracStr, timeUnit) {
|
|
5566
|
-
let leftoverUnits = 0;
|
|
5567
|
-
let wholeUnits = 0;
|
|
5568
|
-
return timeUnit && ([leftoverUnits, leftoverNano] = divModFloor(leftoverNano, unitNanoMap[timeUnit])),
|
|
5569
|
-
void 0 !== wholeStr && (hasAnyFrac && throwRangeError(invalidSubstring(wholeStr)),
|
|
5570
|
-
wholeUnits = (s => {
|
|
5571
|
-
const n = parseInt(s);
|
|
5572
|
-
return Number.isFinite(n) || throwRangeError(invalidSubstring(s)), n;
|
|
5573
|
-
})(wholeStr), hasAny = 1, fracStr && (leftoverNano = parseSubsecNano(fracStr) * (unitNanoMap[timeUnit] / nanoInSec),
|
|
5574
|
-
hasAnyFrac = 1)), leftoverUnits + wholeUnits;
|
|
5575
|
-
}
|
|
5576
|
-
})(parts)));
|
|
5522
|
+
parts && !invalidDurationRegExp.test(s) || throwFailedParse(s);
|
|
5523
|
+
const fraction = nanoToGivenFields(3600 * parseSubsecNano(parts[7] || "") + 60 * parseSubsecNano(parts[9] || "") + parseSubsecNano(parts[11] || ""), 4, durationFieldNamesAsc);
|
|
5524
|
+
const durationFields = {
|
|
5525
|
+
...fraction,
|
|
5526
|
+
years: parseInt0(parts[2]),
|
|
5527
|
+
months: parseInt0(parts[3]),
|
|
5528
|
+
weeks: parseInt0(parts[4]),
|
|
5529
|
+
days: parseInt0(parts[5]),
|
|
5530
|
+
hours: parseInt0(parts[6]),
|
|
5531
|
+
minutes: parseInt0(parts[8]) + fraction.minutes,
|
|
5532
|
+
seconds: parseInt0(parts[10]) + fraction.seconds
|
|
5533
|
+
};
|
|
5534
|
+
return createDurationSlots(validateDurationFields("-" === parts[1] ? negateDurationFields(durationFields) : durationFields));
|
|
5577
5535
|
}
|
|
5578
5536
|
|
|
5579
5537
|
function parseCalendarId(s) {
|
|
5580
|
-
const
|
|
5581
|
-
|
|
5582
|
-
return res.calendarId;
|
|
5583
|
-
}
|
|
5584
|
-
const timeParts = parseTimeOnlyParts(s);
|
|
5585
|
-
return timeParts ? organizeAnnotationParts(timeParts[13]).calendarId : s;
|
|
5538
|
+
const organized = parseDateTimeLike(s) || parseYearMonthOnly(s) || parseMonthDayOnly(s) || parseTimeOnly(s);
|
|
5539
|
+
return organized ? organized.calendarId : s;
|
|
5586
5540
|
}
|
|
5587
5541
|
|
|
5588
5542
|
function parseTimeZoneId(s) {
|
|
5589
5543
|
const parsed = parseDateTimeLike(s);
|
|
5590
|
-
return parsed && (parsed.timeZoneId || parsed.
|
|
5544
|
+
return parsed && (parsed.timeZoneId || parsed.I && "UTC" || parsed.offset) || s;
|
|
5591
5545
|
}
|
|
5592
5546
|
|
|
5593
5547
|
function parsePlainDateLike(s) {
|
|
5594
|
-
const organized = parseDateTimeLike(s);
|
|
5595
|
-
return organized && !organized.
|
|
5596
|
-
}
|
|
5597
|
-
|
|
5598
|
-
function finalizeDateLike(organized, isoDateProjector, resolveCalendar) {
|
|
5599
|
-
return isoDateProjector && "iso8601" === organized.calendarId ? (validateIsoDateFields(organized),
|
|
5600
|
-
organized.te && validateTimeFields(organized), finalizeDate(isoDateProjector(organized), resolveCalendar)) : organized.te ? finalizeDateTime(organized, resolveCalendar) : finalizeDate(organized, resolveCalendar);
|
|
5601
|
-
}
|
|
5602
|
-
|
|
5603
|
-
function projectIsoYearMonthDate(organized) {
|
|
5604
|
-
const day = 12 * organized.year + organized.month === isoYearMonthIndexMin ? 20 : 1;
|
|
5605
|
-
return {
|
|
5606
|
-
...organized,
|
|
5607
|
-
day: day
|
|
5608
|
-
};
|
|
5609
|
-
}
|
|
5610
|
-
|
|
5611
|
-
function projectIsoMonthDayDate(organized) {
|
|
5612
|
-
return {
|
|
5613
|
-
...organized,
|
|
5614
|
-
year: 1972
|
|
5615
|
-
};
|
|
5548
|
+
const organized = parseDateTimeLike(requireString(s));
|
|
5549
|
+
return organized && !organized.I || throwFailedParse(s), organized;
|
|
5616
5550
|
}
|
|
5617
5551
|
|
|
5618
5552
|
function finalizeZonedDateTime(organized, resolveCalendar, options) {
|
|
5619
5553
|
const timeZone = queryTimeZone(resolveTimeZoneId(organized.timeZoneId));
|
|
5620
5554
|
let epochNano;
|
|
5621
|
-
if (
|
|
5555
|
+
if (organized.qe) {
|
|
5622
5556
|
const offsetNano = organized.offset ? parseOffsetNano(organized.offset) : void 0;
|
|
5623
5557
|
const [, offsetDisambig, epochDisambig] = refineZonedFieldOptions(options);
|
|
5624
5558
|
epochNano = getMatchingInstantFor(timeZone, organized, offsetNano, offsetDisambig, epochDisambig, !(timeZone.Z || void 0 === organized.offset || (offset = organized.offset,
|
|
5625
|
-
offset.
|
|
5559
|
+
offset.length > 6)), organized.I);
|
|
5626
5560
|
} else {
|
|
5627
5561
|
refineZonedFieldOptions(options), epochNano = getStartOfDayInstantFor(timeZone, organized);
|
|
5628
5562
|
}
|
|
@@ -5630,115 +5564,91 @@ function finalizeZonedDateTime(organized, resolveCalendar, options) {
|
|
|
5630
5564
|
return checkEpochNanoInBounds(epochNano), createZonedEpochNanoSlots(epochNano, timeZone, resolveCalendar(organized.calendarId));
|
|
5631
5565
|
}
|
|
5632
5566
|
|
|
5633
|
-
function finalizeDateTime(organized, resolveCalendar) {
|
|
5634
|
-
return validateIsoDateTimeFields(organized), checkIsoDateTimeInBounds(organized),
|
|
5635
|
-
{
|
|
5636
|
-
...combineDateAndTime(organized, organized),
|
|
5637
|
-
calendar: resolveCalendar(organized.calendarId)
|
|
5638
|
-
};
|
|
5639
|
-
}
|
|
5640
|
-
|
|
5641
5567
|
function finalizeDate(organized, resolveCalendar) {
|
|
5642
|
-
return
|
|
5643
|
-
calendar: resolveCalendar(organized.calendarId),
|
|
5644
|
-
year: organized.year,
|
|
5645
|
-
month: organized.month,
|
|
5646
|
-
day: organized.day
|
|
5647
|
-
};
|
|
5568
|
+
return createDateSlots(checkIsoDateInBounds(organized), resolveCalendar(organized.calendarId));
|
|
5648
5569
|
}
|
|
5649
5570
|
|
|
5650
|
-
function timeRegExpStr(separatorIndex) {
|
|
5651
|
-
return `(\\d
|
|
5571
|
+
function timeRegExpStr(separatorIndex, leapSecondStr = "") {
|
|
5572
|
+
return `([01]\\d|2[0-3])(?:(:?)([0-5]\\d)(?:\\${separatorIndex}([0-5]\\d${leapSecondStr})(?:[.,](\\d{1,9}))?)?)?`;
|
|
5652
5573
|
}
|
|
5653
5574
|
|
|
5654
|
-
const dateTimeRegExpStr = "(
|
|
5575
|
+
const dateTimeRegExpStr = "((?!-0{6})[+-]\\d{6}|\\d{4})(-?)(0[1-9]|1[0-2])\\2(0[1-9]|[12]\\d|3[01])(?:[Tt ]" + timeRegExpStr(6, "|60") + "(?:([Zz])|(([+-])" + timeRegExpStr(14) + "))?)?";
|
|
5655
5576
|
|
|
5656
|
-
const yearMonthRegExp = /*@__PURE__*/ createRegExp("(
|
|
5577
|
+
const yearMonthRegExp = /*@__PURE__*/ createRegExp("((?!-0{6})[+-]\\d{6}|\\d{4})-?(0[1-9]|1[0-2])(?:\\[!?([+-](?:[01]\\d|2[0-3])(?::?[0-5]\\d)?|[a-zA-Z._][\\w.+-]*(?:/[a-zA-Z._][\\w.+-]*)*)\\])?((?:\\[!?[a-z_][a-z\\d_-]*=[a-zA-Z\\d]+(?:-[a-zA-Z\\d]+)*\\])*)");
|
|
5657
5578
|
|
|
5658
|
-
const monthDayRegExp = /*@__PURE__*/ createRegExp("(?:--)?(
|
|
5579
|
+
const monthDayRegExp = /*@__PURE__*/ createRegExp("(?:--)?(0[1-9]|1[0-2])-?(0[1-9]|[12]\\d|3[01])(?:\\[!?([+-](?:[01]\\d|2[0-3])(?::?[0-5]\\d)?|[a-zA-Z._][\\w.+-]*(?:/[a-zA-Z._][\\w.+-]*)*)\\])?((?:\\[!?[a-z_][a-z\\d_-]*=[a-zA-Z\\d]+(?:-[a-zA-Z\\d]+)*\\])*)");
|
|
5659
5580
|
|
|
5660
|
-
const dateTimeRegExp = /*@__PURE__*/ createRegExp(dateTimeRegExpStr + "(
|
|
5581
|
+
const dateTimeRegExp = /*@__PURE__*/ createRegExp(dateTimeRegExpStr + "(?:\\[!?([+-](?:[01]\\d|2[0-3])(?::?[0-5]\\d)?|[a-zA-Z._][\\w.+-]*(?:/[a-zA-Z._][\\w.+-]*)*)\\])?((?:\\[!?[a-z_][a-z\\d_-]*=[a-zA-Z\\d]+(?:-[a-zA-Z\\d]+)*\\])*)");
|
|
5661
5582
|
|
|
5662
|
-
const
|
|
5583
|
+
const annotationRegExp = /\[(!?)([^=]+)=([^\]]+)/g;
|
|
5663
5584
|
|
|
5664
|
-
const
|
|
5585
|
+
const durationRegExp = /^([+-])?P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(?:T(?:(\d+)(?:[.,](\d{1,9}))?H)?(?:(\d+)(?:[.,](\d{1,9}))?M)?(?:(\d+)(?:[.,](\d{1,9}))?S)?)?$/i;
|
|
5665
5586
|
|
|
5666
|
-
const
|
|
5587
|
+
const invalidDurationRegExp = /[PT]$|[.,]\d+[HMS]./i;
|
|
5667
5588
|
|
|
5668
5589
|
function parseDateTimeLike(s) {
|
|
5669
5590
|
const parts = dateTimeRegExp.exec(s);
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5591
|
+
if (!parts) {
|
|
5592
|
+
return;
|
|
5593
|
+
}
|
|
5594
|
+
const organized = (parts => ({
|
|
5595
|
+
year: parseInt(parts[1]),
|
|
5596
|
+
month: parseInt(parts[3]),
|
|
5597
|
+
day: parseInt(parts[4]),
|
|
5598
|
+
...nanoToTimeAndDay(parseSubsecNano(parts[9] || ""))[0],
|
|
5599
|
+
hour: parseInt0(parts[5]),
|
|
5600
|
+
minute: parseInt0(parts[7]),
|
|
5601
|
+
second: Math.min(parseInt0(parts[8]), 59),
|
|
5602
|
+
...organizeAnnotationParts(parts[18], parts[19]),
|
|
5603
|
+
qe: !!parts[5],
|
|
5604
|
+
I: !!parts[10],
|
|
5605
|
+
offset: parts[11]
|
|
5606
|
+
}))(parts);
|
|
5607
|
+
return validateIsoDateFields(organized);
|
|
5684
5608
|
}
|
|
5685
5609
|
|
|
5686
5610
|
function parseYearMonthOnly(s) {
|
|
5687
5611
|
const parts = yearMonthRegExp.exec(s);
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
}))(parts);
|
|
5695
|
-
}
|
|
5612
|
+
return parts ? requireIsoCalendar((parts => ({
|
|
5613
|
+
year: parseInt(parts[1]),
|
|
5614
|
+
month: parseInt(parts[2]),
|
|
5615
|
+
day: 1,
|
|
5616
|
+
...organizeAnnotationParts(parts[3], parts[4])
|
|
5617
|
+
}))(parts)) : void 0;
|
|
5696
5618
|
}
|
|
5697
5619
|
|
|
5698
5620
|
function parseMonthDayOnly(s) {
|
|
5699
5621
|
const parts = monthDayRegExp.exec(s);
|
|
5700
|
-
return parts ? (parts => ({
|
|
5701
|
-
year: 1972,
|
|
5702
|
-
month: parseInt(parts[1]),
|
|
5703
|
-
day: parseInt(parts[2]),
|
|
5704
|
-
...organizeAnnotationParts(parts[3])
|
|
5705
|
-
}))(parts) : void 0;
|
|
5706
|
-
}
|
|
5707
|
-
|
|
5708
|
-
function parseTimeOnlyParts(s) {
|
|
5709
|
-
const parts = timeRegExp.exec(s);
|
|
5710
5622
|
if (parts) {
|
|
5711
|
-
|
|
5623
|
+
const organized = (parts => ({
|
|
5624
|
+
year: 1972,
|
|
5625
|
+
month: parseInt(parts[1]),
|
|
5626
|
+
day: parseInt(parts[2]),
|
|
5627
|
+
...organizeAnnotationParts(parts[3], parts[4])
|
|
5628
|
+
}))(parts);
|
|
5629
|
+
if (allPropsEqual(calendarDateFieldNamesAsc, isoDate = organized, constrainIsoDateFields(isoDate))) {
|
|
5630
|
+
return requireIsoCalendar(organized);
|
|
5631
|
+
}
|
|
5712
5632
|
}
|
|
5633
|
+
var isoDate;
|
|
5713
5634
|
}
|
|
5714
5635
|
|
|
5715
|
-
function
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
...nanoToTimeAndDay(parseSubsecNano(parts[hourIndex + 4] || ""))[0],
|
|
5719
|
-
hour: parseInt0(parts[hourIndex]),
|
|
5720
|
-
minute: parseInt0(parts[hourIndex + 2]),
|
|
5721
|
-
second: 60 === second ? 59 : second
|
|
5722
|
-
};
|
|
5636
|
+
function requireIsoCalendar(organized) {
|
|
5637
|
+
return "iso8601" !== organized.calendarId && throwFailedParse(organized.calendarId),
|
|
5638
|
+
organized;
|
|
5723
5639
|
}
|
|
5724
5640
|
|
|
5725
|
-
function
|
|
5726
|
-
const
|
|
5727
|
-
|
|
5728
|
-
return yearSign < 0 && !year && throwRangeError(invalidSubstring(-0)), yearSign * year;
|
|
5641
|
+
function parseTimeOnly(s) {
|
|
5642
|
+
const organized = parseDateTimeLike(s.replace(/^t?/i, "0000-01-01T"));
|
|
5643
|
+
return organized && !organized.I ? organized : void 0;
|
|
5729
5644
|
}
|
|
5730
5645
|
|
|
5731
|
-
function organizeAnnotationParts(s) {
|
|
5646
|
+
function organizeAnnotationParts(timeZoneId, s) {
|
|
5732
5647
|
let calendarIsCritical;
|
|
5733
|
-
let timeZoneId;
|
|
5734
5648
|
const calendarIds = [];
|
|
5735
|
-
return s.replace(annotationRegExp, (whole, criticalStr,
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
return name ? "u-ca" === name ? (calendarIds.push(val.toLowerCase()), calendarIsCritical || (calendarIsCritical = isCritical)) : (isCritical || /[A-Z]/.test(name)) && throwRangeError(invalidSubstring(whole)) : (timeZoneId && throwRangeError(invalidSubstring(whole)),
|
|
5739
|
-
timeZoneId = val), "";
|
|
5740
|
-
}), calendarIds.length > 1 && calendarIsCritical && throwRangeError(invalidSubstring(s)),
|
|
5741
|
-
{
|
|
5649
|
+
return s.replace(annotationRegExp, (whole, criticalStr, key, value) => ("u-ca" === key ? (calendarIds.push(value.toLowerCase()),
|
|
5650
|
+
calendarIsCritical || (calendarIsCritical = criticalStr)) : criticalStr && throwFailedParse(whole),
|
|
5651
|
+
"")), calendarIds.length > 1 && calendarIsCritical && throwFailedParse(s), {
|
|
5742
5652
|
timeZoneId: timeZoneId,
|
|
5743
5653
|
calendarId: calendarIds[0] || "iso8601"
|
|
5744
5654
|
};
|
|
@@ -6092,12 +6002,8 @@ const transformMonthDayOptions = /*@__PURE__*/ createOptionsTransformer([ "month
|
|
|
6092
6002
|
|
|
6093
6003
|
function zonedDateTimeWithPlainTime(zonedDateTimeSlots, plainTimeFields) {
|
|
6094
6004
|
const {timeZone: timeZone} = zonedDateTimeSlots;
|
|
6095
|
-
const
|
|
6096
|
-
|
|
6097
|
-
const time = plainTimeFields || timeFieldDefaults;
|
|
6098
|
-
let epochNano;
|
|
6099
|
-
return epochNano = plainTimeFields ? getMatchingInstantFor(timeZone, combineDateAndTime(isoDateTime, time), offsetNanoseconds, 2) : getStartOfDayInstantFor(timeZone, combineDateAndTime(isoDateTime, time)),
|
|
6100
|
-
createZonedEpochNanoSlots(epochNano, timeZone, zonedDateTimeSlots.calendar);
|
|
6005
|
+
const newIsoDateTime = combineDateAndTime(zonedEpochSlotsToIso(zonedDateTimeSlots), plainTimeFields || timeFieldDefaults);
|
|
6006
|
+
return createZonedEpochNanoSlots(plainTimeFields ? getSingleInstantFor(timeZone, newIsoDateTime) : getStartOfDayInstantFor(timeZone, newIsoDateTime), timeZone, zonedDateTimeSlots.calendar);
|
|
6101
6007
|
}
|
|
6102
6008
|
|
|
6103
6009
|
function refineDirectionOptions(options) {
|
|
@@ -6117,7 +6023,7 @@ function getCurrentEpochNano() {
|
|
|
6117
6023
|
}
|
|
6118
6024
|
|
|
6119
6025
|
function getCurrentTimeZoneId() {
|
|
6120
|
-
return (new RawDateTimeFormat).resolvedOptions().timeZone;
|
|
6026
|
+
return (new RawDateTimeFormat).resolvedOptions().timeZone || "UTC";
|
|
6121
6027
|
}
|
|
6122
6028
|
|
|
6123
6029
|
function createDateTimeFormatShell(createArgsProvider, transformOptions = identity) {
|
|
@@ -6143,7 +6049,7 @@ function createDateTimeFormatShell(createArgsProvider, transformOptions = identi
|
|
|
6143
6049
|
$: createArgsProvider({
|
|
6144
6050
|
t: baseFormat,
|
|
6145
6051
|
Ce: resolvedOptions.locale,
|
|
6146
|
-
|
|
6052
|
+
F: copiedOptions,
|
|
6147
6053
|
Ee: transformedOptions
|
|
6148
6054
|
}),
|
|
6149
6055
|
t: baseFormat
|
|
@@ -6215,11 +6121,11 @@ function defineTemporalClass(branding, cls, getSlots, ...getterMaps) {
|
|
|
6215
6121
|
}), Object.assign({}, ...getterMaps))), cls;
|
|
6216
6122
|
}
|
|
6217
6123
|
|
|
6218
|
-
const attachDebugString = "noop"
|
|
6124
|
+
const attachDebugString = "noop" !== noop.name || globalThis.process ? noop : instance => {
|
|
6219
6125
|
Object.defineProperty(instance, "_str_", {
|
|
6220
6126
|
value: instance.toJSON()
|
|
6221
6127
|
});
|
|
6222
|
-
}
|
|
6128
|
+
};
|
|
6223
6129
|
|
|
6224
6130
|
function invalidRecordType() {
|
|
6225
6131
|
throwTypeError(invalidCallingContext);
|
|
@@ -6412,27 +6318,27 @@ function createDateTimeFormatClass(getTemporalBrandingAndSlots) {
|
|
|
6412
6318
|
let options;
|
|
6413
6319
|
switch (branding) {
|
|
6414
6320
|
case InstantBranding:
|
|
6415
|
-
options = transformInstantOptions(internals.
|
|
6321
|
+
options = transformInstantOptions(internals.F, 1);
|
|
6416
6322
|
break;
|
|
6417
6323
|
|
|
6418
6324
|
case PlainDateTimeBranding:
|
|
6419
|
-
options = applyPlainFormatTimeZone(transformDateTimeOptions(internals.
|
|
6325
|
+
options = applyPlainFormatTimeZone(transformDateTimeOptions(internals.F, 1));
|
|
6420
6326
|
break;
|
|
6421
6327
|
|
|
6422
6328
|
case PlainDateBranding:
|
|
6423
|
-
options = applyPlainFormatTimeZone(transformDateOptions(internals.
|
|
6329
|
+
options = applyPlainFormatTimeZone(transformDateOptions(internals.F, 1));
|
|
6424
6330
|
break;
|
|
6425
6331
|
|
|
6426
6332
|
case PlainTimeBranding:
|
|
6427
|
-
options = applyPlainFormatTimeZone(transformTimeOptions(internals.
|
|
6333
|
+
options = applyPlainFormatTimeZone(transformTimeOptions(internals.F, 1));
|
|
6428
6334
|
break;
|
|
6429
6335
|
|
|
6430
6336
|
case PlainYearMonthBranding:
|
|
6431
|
-
options = applyPlainFormatTimeZone(transformYearMonthOptions(internals.
|
|
6337
|
+
options = applyPlainFormatTimeZone(transformYearMonthOptions(internals.F, 1));
|
|
6432
6338
|
break;
|
|
6433
6339
|
|
|
6434
6340
|
case PlainMonthDayBranding:
|
|
6435
|
-
options = applyPlainFormatTimeZone(transformMonthDayOptions(internals.
|
|
6341
|
+
options = applyPlainFormatTimeZone(transformMonthDayOptions(internals.F, 1));
|
|
6436
6342
|
break;
|
|
6437
6343
|
|
|
6438
6344
|
default:
|
|
@@ -7024,7 +6930,7 @@ const PlainTime = /*@__PURE__*/ defineTemporalClass(PlainTimeBranding, class {
|
|
|
7024
6930
|
round(options) {
|
|
7025
6931
|
const slots = getPlainTimeSlots(this);
|
|
7026
6932
|
const [smallestUnit, roundingInc, roundingMode] = refineRoundingOptions(options, 5);
|
|
7027
|
-
return createPlainTime(
|
|
6933
|
+
return createPlainTime(roundTimeToUnit(slots, smallestUnit, roundingInc, roundingMode)[0]);
|
|
7028
6934
|
}
|
|
7029
6935
|
equals(other) {
|
|
7030
6936
|
return plainTimesEqual(getPlainTimeSlots(this), toPlainTimeSlots(other));
|
|
@@ -7142,7 +7048,7 @@ const PlainDateTime = /*@__PURE__*/ defineTemporalClass(PlainDateTimeBranding, c
|
|
|
7142
7048
|
round(options) {
|
|
7143
7049
|
const slots = getPlainDateTimeSlots(this);
|
|
7144
7050
|
const [smallestUnit, roundingInc, roundingMode] = refineRoundingOptions(options);
|
|
7145
|
-
return createPlainDateTime(createDateTimeSlots(
|
|
7051
|
+
return createPlainDateTime(createDateTimeSlots(roundDateTimeToUnit(slots, smallestUnit, roundingInc, roundingMode), slots.calendar));
|
|
7146
7052
|
}
|
|
7147
7053
|
equals(otherArg) {
|
|
7148
7054
|
return plainDateTimesEqual(getPlainDateTimeSlots(this), toPlainDateTimeSlots(otherArg));
|
|
@@ -9980,11 +9886,12 @@ const GEOMETRIC_ZENITH = 90;
|
|
|
9980
9886
|
*/
|
|
9981
9887
|
const CIVIL_ZENITH = GEOMETRIC_ZENITH + 6;
|
|
9982
9888
|
/**
|
|
9983
|
-
* The zenith of 1.
|
|
9889
|
+
* The zenith of 1° 35' (1.58333°) below geometric zenith (90°). This calculation is used for
|
|
9984
9890
|
* calculating _netz amiti_ (sunrise) and _shkiah amiti_ (sunset) based on the opinion of the
|
|
9985
9891
|
* [Baal Hatanya](https://en.wikipedia.org/wiki/Shneur_Zalman_of_Liadi).
|
|
9892
|
+
* The exact 1° 35', not 1.583°, matches the times Chabad.org publishes.
|
|
9986
9893
|
*/
|
|
9987
|
-
const ZENITH_1_POINT_583 = GEOMETRIC_ZENITH + 1
|
|
9894
|
+
const ZENITH_1_POINT_583 = GEOMETRIC_ZENITH + 1 + 35 / 60;
|
|
9988
9895
|
/**
|
|
9989
9896
|
* Tzeit HaKochavim as calculated by Rabbi Yechiel Michel Tucazinsky,
|
|
9990
9897
|
* 6.45° below the horizon. Default end time for Tish'a B'Av.
|
|
@@ -10012,6 +9919,149 @@ const DEG_8_POINT_5 = 8.5;
|
|
|
10012
9919
|
*/
|
|
10013
9920
|
const DEG_16_POINT_1 = 16.1;
|
|
10014
9921
|
|
|
9922
|
+
/**
|
|
9923
|
+
* Pure arithmetic for the "visible" sunrise/sunset (_netz ha-nireh_,
|
|
9924
|
+
* הנץ הנראה): resolving a caller-supplied terrain horizon profile, atmospheric
|
|
9925
|
+
* refraction, and the apparent altitude of the sun's upper limb.
|
|
9926
|
+
*
|
|
9927
|
+
* The method follows Keller & Hall, _Using a digital terrain model to
|
|
9928
|
+
* calculate visual sunrise and sunset times_, Computers & Geosciences 26
|
|
9929
|
+
* (2000) 991–1000, https://doi.org/10.1016/S0098-3004(00)00058-3 (a copy is
|
|
9930
|
+
* hosted at http://www.chaitables.com/DblHallpaperpub.htm), and their part II,
|
|
9931
|
+
* Computers & Geosciences 162 (2022) 105044,
|
|
9932
|
+
* https://doi.org/10.1016/j.cageo.2022.105044, which re-examines the
|
|
9933
|
+
* refraction model with ray tracing and finds the standard formulas adequate.
|
|
9934
|
+
* It matches the conventions of the Chai Tables (https://www.chaitables.com),
|
|
9935
|
+
* the authors' public service that computes these times for the printed
|
|
9936
|
+
* Israeli calendars; their conventions are described at
|
|
9937
|
+
* http://www.chaitables.com/Introduction_to_DTM_calculations.html.
|
|
9938
|
+
*
|
|
9939
|
+
* Refraction uses the Sinclair model below 15° and the Bennett model at or
|
|
9940
|
+
* above 15°, both at standard atmosphere (1010 hPa, 10 °C), matching the Chai
|
|
9941
|
+
* Tables. Bennett's formula is from G. G. Bennett, _The calculation of
|
|
9942
|
+
* astronomical refraction in marine navigation_, Journal of Navigation 35
|
|
9943
|
+
* (1982) 255–259, https://doi.org/10.1017/S0373463300022037; Sinclair's
|
|
9944
|
+
* low-altitude formula is the one given in the _Explanatory Supplement to the
|
|
9945
|
+
* Astronomical Almanac_ (ed. Seidelmann, 1992), §3.283, and both are
|
|
9946
|
+
* reproduced in Keller & Hall (2000). "Visible" means the moment the sun's
|
|
9947
|
+
* _upper limb_ (semidiameter 16′), bent up by refraction, first clears
|
|
9948
|
+
* (sunrise) or last touches (sunset) the real skyline. No cushion or safety
|
|
9949
|
+
* margin is added — the raw computed instant is returned (the Chai Tables add
|
|
9950
|
+
* 20 seconds).
|
|
9951
|
+
*
|
|
9952
|
+
* This module is pure: it depends on nothing from `@hebcal/noaa` and performs
|
|
9953
|
+
* no I/O. The horizon profile is always supplied by the caller; building one
|
|
9954
|
+
* from terrain / digital-elevation-model data is outside this library.
|
|
9955
|
+
*/
|
|
9956
|
+
/**
|
|
9957
|
+
* The sun's angular semidiameter in degrees (16 arcminutes), matching the
|
|
9958
|
+
* value `@hebcal/noaa` folds into its `GEOMETRIC_ZENITH` adjustment.
|
|
9959
|
+
*/
|
|
9960
|
+
const SOLAR_SEMIDIAMETER = 16 / 60;
|
|
9961
|
+
/**
|
|
9962
|
+
* Resolves a {@link HorizonProfile} at a single azimuth.
|
|
9963
|
+
*
|
|
9964
|
+
* A constant returns itself; a function is invoked; a sample list is linearly
|
|
9965
|
+
* interpolated between its two neighbouring samples by azimuth, wrapping
|
|
9966
|
+
* around 360°/0°. A single sample behaves as a constant.
|
|
9967
|
+
* @param profile the horizon profile
|
|
9968
|
+
* @param azimuth degrees clockwise from true north
|
|
9969
|
+
* @throws {TypeError} for an empty sample array or a non-finite constant
|
|
9970
|
+
*/
|
|
9971
|
+
function horizonElevation(profile, azimuth) {
|
|
9972
|
+
if (typeof profile === 'number') {
|
|
9973
|
+
if (!Number.isFinite(profile)) {
|
|
9974
|
+
throw new TypeError(`invalid horizon elevation: ${profile}`);
|
|
9975
|
+
}
|
|
9976
|
+
return profile;
|
|
9977
|
+
}
|
|
9978
|
+
if (typeof profile === 'function') {
|
|
9979
|
+
return profile(azimuth);
|
|
9980
|
+
}
|
|
9981
|
+
const n = profile.length;
|
|
9982
|
+
if (n === 0) {
|
|
9983
|
+
throw new TypeError('horizon profile has no samples');
|
|
9984
|
+
}
|
|
9985
|
+
if (n === 1) {
|
|
9986
|
+
return profile[0].elevation;
|
|
9987
|
+
}
|
|
9988
|
+
const sorted = [...profile].sort((a, b) => a.azimuth - b.azimuth);
|
|
9989
|
+
let az = azimuth % 360;
|
|
9990
|
+
if (az < 0) {
|
|
9991
|
+
az += 360;
|
|
9992
|
+
}
|
|
9993
|
+
// Largest sample azimuth that is still <= the query azimuth.
|
|
9994
|
+
let loIdx = -1;
|
|
9995
|
+
for (let i = 0; i < n; i++) {
|
|
9996
|
+
if (sorted[i].azimuth <= az) {
|
|
9997
|
+
loIdx = i;
|
|
9998
|
+
}
|
|
9999
|
+
else {
|
|
10000
|
+
break;
|
|
10001
|
+
}
|
|
10002
|
+
}
|
|
10003
|
+
let lo;
|
|
10004
|
+
let hi;
|
|
10005
|
+
let loAz;
|
|
10006
|
+
let hiAz;
|
|
10007
|
+
if (loIdx === -1) {
|
|
10008
|
+
// Below the smallest azimuth: wrap, previous neighbour is the last sample.
|
|
10009
|
+
lo = sorted[n - 1];
|
|
10010
|
+
loAz = lo.azimuth - 360;
|
|
10011
|
+
hi = sorted[0];
|
|
10012
|
+
hiAz = hi.azimuth;
|
|
10013
|
+
}
|
|
10014
|
+
else if (loIdx === n - 1) {
|
|
10015
|
+
// At or above the largest azimuth: wrap, next neighbour is the first.
|
|
10016
|
+
lo = sorted[n - 1];
|
|
10017
|
+
loAz = lo.azimuth;
|
|
10018
|
+
hi = sorted[0];
|
|
10019
|
+
hiAz = hi.azimuth + 360;
|
|
10020
|
+
}
|
|
10021
|
+
else {
|
|
10022
|
+
lo = sorted[loIdx];
|
|
10023
|
+
loAz = lo.azimuth;
|
|
10024
|
+
hi = sorted[loIdx + 1];
|
|
10025
|
+
hiAz = hi.azimuth;
|
|
10026
|
+
}
|
|
10027
|
+
const t = hiAz === loAz ? 0 : (az - loAz) / (hiAz - loAz);
|
|
10028
|
+
return lo.elevation + t * (hi.elevation - lo.elevation);
|
|
10029
|
+
}
|
|
10030
|
+
/**
|
|
10031
|
+
* Atmospheric refraction at a given apparent altitude, in degrees, at standard
|
|
10032
|
+
* atmosphere (1010 hPa, 10 °C). Sinclair's formula below 15°, Bennett's at or
|
|
10033
|
+
* above 15° — the pairing the Chai Tables use.
|
|
10034
|
+
* @param apparentAltitude apparent altitude of the body above the horizon, in degrees
|
|
10035
|
+
*/
|
|
10036
|
+
function refractionAtApparentAltitude(apparentAltitude) {
|
|
10037
|
+
const P = 1010;
|
|
10038
|
+
const T = 10;
|
|
10039
|
+
const a = apparentAltitude;
|
|
10040
|
+
if (a < 15) {
|
|
10041
|
+
return (((P / (T + 273)) * (0.1594 + 0.0196 * a + 0.00002 * a * a)) /
|
|
10042
|
+
(1 + 0.505 * a + 0.0845 * a * a));
|
|
10043
|
+
}
|
|
10044
|
+
return (((1 / 60) * (P / 1010) * (283 / (273 + T))) /
|
|
10045
|
+
Math.tan(((a + 7.31 / (a + 4.4)) * Math.PI) / 180));
|
|
10046
|
+
}
|
|
10047
|
+
/**
|
|
10048
|
+
* Given the sun's geometric centre altitude, returns the apparent altitude of
|
|
10049
|
+
* its upper limb — adding the semidiameter and solving the implicit
|
|
10050
|
+
* refraction equation `β = a + SD + R(β)` by fixed-point iteration.
|
|
10051
|
+
*
|
|
10052
|
+
* `upperLimbApparentAltitude(-0.8333)` is ≈ 0, i.e. the standard sea-level
|
|
10053
|
+
* sunrise/sunset definition (upper limb on the astronomical horizon).
|
|
10054
|
+
* @param centerGeometricAltitude geometric altitude of the sun's centre, in degrees
|
|
10055
|
+
*/
|
|
10056
|
+
function upperLimbApparentAltitude(centerGeometricAltitude) {
|
|
10057
|
+
const base = centerGeometricAltitude + SOLAR_SEMIDIAMETER;
|
|
10058
|
+
let beta = base + refractionAtApparentAltitude(base);
|
|
10059
|
+
for (let i = 0; i < 4; i++) {
|
|
10060
|
+
beta = base + refractionAtApparentAltitude(beta);
|
|
10061
|
+
}
|
|
10062
|
+
return beta;
|
|
10063
|
+
}
|
|
10064
|
+
|
|
10015
10065
|
/**
|
|
10016
10066
|
* Converts an instant to a `Date`, discarding milliseconds.
|
|
10017
10067
|
*
|
|
@@ -10222,10 +10272,16 @@ class Zmanim {
|
|
|
10222
10272
|
* `useElevation` setting.
|
|
10223
10273
|
*/
|
|
10224
10274
|
chatzot() {
|
|
10275
|
+
return millisToDate(this.chatzotMillis());
|
|
10276
|
+
}
|
|
10277
|
+
/**
|
|
10278
|
+
* {@link chatzot} as epoch milliseconds, before the seconds are cut.
|
|
10279
|
+
*/
|
|
10280
|
+
chatzotMillis() {
|
|
10225
10281
|
const startOfDay = this.sunriseMillis(GEOMETRIC_ZENITH, false);
|
|
10226
10282
|
const endOfDay = this.sunsetMillis(GEOMETRIC_ZENITH, false);
|
|
10227
10283
|
// NOAACalculator.getSunTransit(): sunrise plus 6 temporal hours
|
|
10228
|
-
return
|
|
10284
|
+
return startOfDay + temporalHourMillis(startOfDay, endOfDay) * 6;
|
|
10229
10285
|
}
|
|
10230
10286
|
/**
|
|
10231
10287
|
* Midnight – Chatzot; Sunset plus 6 halachic hours.
|
|
@@ -10516,6 +10572,190 @@ class Zmanim {
|
|
|
10516
10572
|
shkiah() {
|
|
10517
10573
|
return this.sunset();
|
|
10518
10574
|
}
|
|
10575
|
+
/**
|
|
10576
|
+
* Visible sunrise — _netz ha-nireh_ (הנץ הנראה): the moment the sun's upper
|
|
10577
|
+
* limb, bent up by atmospheric refraction, first clears the real terrain
|
|
10578
|
+
* skyline to the east, rather than the flat sea-level horizon {@link sunrise}
|
|
10579
|
+
* uses. In mountainous locations (most of Israel) this is noticeably later
|
|
10580
|
+
* than {@link sunrise}; many printed Israeli calendars list it alongside the
|
|
10581
|
+
* standard time.
|
|
10582
|
+
*
|
|
10583
|
+
* The caller supplies a {@link HorizonProfile} — the apparent altitude of the
|
|
10584
|
+
* skyline as a function of azimuth (a constant, a list of
|
|
10585
|
+
* azimuth/elevation samples, or a function). Building such a profile from
|
|
10586
|
+
* terrain / digital-elevation-model data is outside this library.
|
|
10587
|
+
*
|
|
10588
|
+
* The method follows Keller & Hall, _Computers & Geosciences_ 26 (2000), and
|
|
10589
|
+
* the Chai Tables (chaitables.com): refraction is Sinclair below 15° and
|
|
10590
|
+
* Bennett at or above 15° at standard atmosphere (1010 hPa, 10 °C), applied
|
|
10591
|
+
* to the sun's upper limb. No cushion or safety margin is added.
|
|
10592
|
+
*
|
|
10593
|
+
* The `useElevation` setting is intentionally ignored: the profile is
|
|
10594
|
+
* measured from the observer's own eye position (already accounting for the
|
|
10595
|
+
* observer's height, terrestrial refraction and Earth's curvature — a sea
|
|
10596
|
+
* horizon seen from a height is a negative angle), so applying the library's
|
|
10597
|
+
* sea-level-vs-elevation adjustment on top would double-count.
|
|
10598
|
+
* @example
|
|
10599
|
+
* import {GeoLocation, Zmanim} from '@hebcal/core';
|
|
10600
|
+
* const gloc = new GeoLocation('Jerusalem', 31.78, 35.22, 0, 'Asia/Jerusalem');
|
|
10601
|
+
* const zmanim = new Zmanim(gloc, new Date(2026, 9, 29), false);
|
|
10602
|
+
* const tzid = 'Asia/Jerusalem';
|
|
10603
|
+
* // A constant: the skyline is 3° above level in every direction
|
|
10604
|
+
* Zmanim.formatISOWithTimeZone(tzid, zmanim.visibleSunrise(3));
|
|
10605
|
+
* // '2026-10-29T06:09:07+02:00'
|
|
10606
|
+
* // Samples: a 5° ridge to the east (azimuth 90), flat elsewhere; values
|
|
10607
|
+
* // between samples are interpolated, and the list wraps around at 360°
|
|
10608
|
+
* const ridge = [
|
|
10609
|
+
* {azimuth: 60, elevation: 0},
|
|
10610
|
+
* {azimuth: 80, elevation: 5},
|
|
10611
|
+
* {azimuth: 100, elevation: 5},
|
|
10612
|
+
* {azimuth: 120, elevation: 0},
|
|
10613
|
+
* ];
|
|
10614
|
+
* Zmanim.formatISOWithTimeZone(tzid, zmanim.visibleSunrise(ridge));
|
|
10615
|
+
* // '2026-10-29T06:09:43+02:00'
|
|
10616
|
+
* // A function of azimuth (degrees clockwise from true north)
|
|
10617
|
+
* Zmanim.formatISOWithTimeZone(tzid, zmanim.visibleSunrise((az) => (az > 70 && az < 110 ? 5 : 0)));
|
|
10618
|
+
* // '2026-10-29T06:19:24+02:00'
|
|
10619
|
+
* // A flat profile of 0 reproduces sunrise() to within a second
|
|
10620
|
+
* Zmanim.formatISOWithTimeZone(tzid, zmanim.visibleSunrise(0));
|
|
10621
|
+
* // '2026-10-29T05:52:46+02:00'
|
|
10622
|
+
* Zmanim.formatISOWithTimeZone(tzid, zmanim.sunrise());
|
|
10623
|
+
* // '2026-10-29T05:52:46+02:00'
|
|
10624
|
+
* @param horizon the terrain horizon profile
|
|
10625
|
+
* @return the `Date` (to the second) when the sun first becomes visible, or
|
|
10626
|
+
* an `Invalid Date` when there is no such crossing that day (polar
|
|
10627
|
+
* night/day, or the sun never clears the profile).
|
|
10628
|
+
*/
|
|
10629
|
+
visibleSunrise(horizon) {
|
|
10630
|
+
return this.visibleSunMillis(horizon, true);
|
|
10631
|
+
}
|
|
10632
|
+
/**
|
|
10633
|
+
* Visible sunset — _shkiah nireit_ (שקיעה נראית): the symmetric evening
|
|
10634
|
+
* counterpart of {@link visibleSunrise}, the last moment the sun's upper
|
|
10635
|
+
* limb is visible above the real terrain skyline to the west before it
|
|
10636
|
+
* disappears behind the ridge line.
|
|
10637
|
+
*
|
|
10638
|
+
* See {@link visibleSunrise} for the horizon-profile argument, the
|
|
10639
|
+
* refraction model, the upper-limb convention, that no cushion is added, and
|
|
10640
|
+
* why `useElevation` is ignored.
|
|
10641
|
+
* @example
|
|
10642
|
+
* import {GeoLocation, Zmanim} from '@hebcal/core';
|
|
10643
|
+
* // 300 m up on the Carmel: the sea horizon to the west sits about half a
|
|
10644
|
+
* // degree *below* level, so the visible sunset is later than sunset()
|
|
10645
|
+
* const tzid = 'Asia/Jerusalem';
|
|
10646
|
+
* const gloc = new GeoLocation('Haifa', 32.8, 34.98, 300, tzid);
|
|
10647
|
+
* const zmanim = new Zmanim(gloc, new Date(2026, 9, 29), false);
|
|
10648
|
+
* Zmanim.formatISOWithTimeZone(tzid, zmanim.sunset());
|
|
10649
|
+
* // '2026-10-29T16:52:01+02:00'
|
|
10650
|
+
* Zmanim.formatISOWithTimeZone(tzid, zmanim.visibleSunset((az) => (az > 240 && az < 300 ? -0.5 : 0)));
|
|
10651
|
+
* // '2026-10-29T16:55:07+02:00'
|
|
10652
|
+
* @param horizon the terrain horizon profile
|
|
10653
|
+
* @return the `Date` (to the second) when the sun was last visible, or an
|
|
10654
|
+
* `Invalid Date` when there is no such crossing that day.
|
|
10655
|
+
*/
|
|
10656
|
+
visibleSunset(horizon) {
|
|
10657
|
+
return this.visibleSunMillis(horizon, false);
|
|
10658
|
+
}
|
|
10659
|
+
/**
|
|
10660
|
+
* Alias for {@link visibleSunrise}
|
|
10661
|
+
* @param horizon the terrain horizon profile
|
|
10662
|
+
*/
|
|
10663
|
+
neitzHaNireh(horizon) {
|
|
10664
|
+
return this.visibleSunrise(horizon);
|
|
10665
|
+
}
|
|
10666
|
+
/**
|
|
10667
|
+
* Alias for {@link visibleSunset}
|
|
10668
|
+
* @param horizon the terrain horizon profile
|
|
10669
|
+
*/
|
|
10670
|
+
shkiahNireit(horizon) {
|
|
10671
|
+
return this.visibleSunset(horizon);
|
|
10672
|
+
}
|
|
10673
|
+
/**
|
|
10674
|
+
* Shared search driving {@link visibleSunrise} / {@link visibleSunset}.
|
|
10675
|
+
*
|
|
10676
|
+
* Scans the sun's geometric centre altitude `a` upward from −2.5° to +10° in
|
|
10677
|
+
* 0.05° steps. At each step it maps `a` to a time (via the sea-level
|
|
10678
|
+
* sunrise/sunset for the zenith `90 − a`) and that time to the sun's azimuth,
|
|
10679
|
+
* then compares the upper limb's apparent altitude against the horizon
|
|
10680
|
+
* profile at that azimuth. The sun is visible once that difference `g` is
|
|
10681
|
+
* `≥ 0`; the first upward crossing is bisected to 0.0005° and its time
|
|
10682
|
+
* returned. For sunrise this is the first moment seen; for sunset (same
|
|
10683
|
+
* upward scan, afternoon times) it is the last moment seen.
|
|
10684
|
+
* @param horizon the terrain horizon profile
|
|
10685
|
+
* @param rising `true` for the morning, `false` for the evening
|
|
10686
|
+
*/
|
|
10687
|
+
visibleSunMillis(horizon, rising) {
|
|
10688
|
+
const lat = this.gloc.getLatitude();
|
|
10689
|
+
const lon = this.gloc.getLongitude();
|
|
10690
|
+
const timeAt = (a) => {
|
|
10691
|
+
// adjustZenith() silently folds in refraction + semidiameter when the
|
|
10692
|
+
// zenith is exactly 90° (GEOMETRIC_ZENITH), which would corrupt the
|
|
10693
|
+
// geometric-altitude mapping. Nudge by 1e-9° — far below the 0.0005°
|
|
10694
|
+
// bisection tolerance, so harmless — to steer clear of that branch.
|
|
10695
|
+
let zenith = 90 - a;
|
|
10696
|
+
if (zenith === 90) {
|
|
10697
|
+
zenith = 90 + 1e-9;
|
|
10698
|
+
}
|
|
10699
|
+
const utc = rising
|
|
10700
|
+
? this.noaa.getUTCSeaLevelSunrise(zenith)
|
|
10701
|
+
: this.noaa.getUTCSeaLevelSunset(zenith);
|
|
10702
|
+
return this.noaa.getEpochMillisFromTime(utc, rising);
|
|
10703
|
+
};
|
|
10704
|
+
const azimuthAt = (t) => {
|
|
10705
|
+
// The zone must be 'UTC': getSolarAzimuth() reads .hour/.minute/.second
|
|
10706
|
+
// as UTC wall-clock fields.
|
|
10707
|
+
const zdt = Temporal.Instant.fromEpochMilliseconds(t).toZonedDateTimeISO('UTC');
|
|
10708
|
+
// getSolarAzimuth() uses atan() without quadrant resolution, so its
|
|
10709
|
+
// result is only correct modulo 180°. Fold into [0,180) and add 180° in
|
|
10710
|
+
// the evening so morning azimuths lie in (0°,180°) and evening ones in
|
|
10711
|
+
// (180°,360°). This is a no-op for an already-correct azimuth (a correct
|
|
10712
|
+
// morning azimuth is already in (0°,180°); a correct evening azimuth maps
|
|
10713
|
+
// to itself), so it stays correct if a future noaa resolves the quadrant.
|
|
10714
|
+
let az = NOAACalculator.getSolarAzimuth(zdt, lat, lon);
|
|
10715
|
+
az = ((az % 180) + 180) % 180;
|
|
10716
|
+
if (!rising) {
|
|
10717
|
+
az += 180;
|
|
10718
|
+
}
|
|
10719
|
+
return az;
|
|
10720
|
+
};
|
|
10721
|
+
const g = (a) => upperLimbApparentAltitude(a) -
|
|
10722
|
+
horizonElevation(horizon, azimuthAt(timeAt(a)));
|
|
10723
|
+
const aLo = -2.5;
|
|
10724
|
+
const aHi = 10;
|
|
10725
|
+
const step = 0.05;
|
|
10726
|
+
const tol = 0.0005;
|
|
10727
|
+
// Evaluate the low end first so polar day/night (NaN time) is caught at once.
|
|
10728
|
+
const tLo = timeAt(aLo);
|
|
10729
|
+
if (Number.isNaN(tLo)) {
|
|
10730
|
+
return millisToDate(NaN);
|
|
10731
|
+
}
|
|
10732
|
+
if (g(aLo) >= 0) {
|
|
10733
|
+
return millisToDate(tLo);
|
|
10734
|
+
}
|
|
10735
|
+
let prevA = aLo;
|
|
10736
|
+
for (let a = aLo + step; a <= aHi + 1e-9; a += step) {
|
|
10737
|
+
if (Number.isNaN(timeAt(a))) {
|
|
10738
|
+
return millisToDate(NaN);
|
|
10739
|
+
}
|
|
10740
|
+
if (g(a) >= 0) {
|
|
10741
|
+
// Crossing in (prevA, a): bisect the altitude bracket to 0.0005°.
|
|
10742
|
+
let lo = prevA;
|
|
10743
|
+
let hi = a;
|
|
10744
|
+
while (hi - lo > tol) {
|
|
10745
|
+
const mid = (lo + hi) / 2;
|
|
10746
|
+
if (g(mid) >= 0) {
|
|
10747
|
+
hi = mid;
|
|
10748
|
+
}
|
|
10749
|
+
else {
|
|
10750
|
+
lo = mid;
|
|
10751
|
+
}
|
|
10752
|
+
}
|
|
10753
|
+
return millisToDate(timeAt(hi));
|
|
10754
|
+
}
|
|
10755
|
+
prevA = a;
|
|
10756
|
+
}
|
|
10757
|
+
return millisToDate(NaN);
|
|
10758
|
+
}
|
|
10519
10759
|
/**
|
|
10520
10760
|
* Rabbeinu Tam holds that bein hashmashos is a specific time
|
|
10521
10761
|
* between sunset and tzeis hakochavim.
|
|
@@ -10760,7 +11000,7 @@ class Zmanim {
|
|
|
10760
11000
|
*
|
|
10761
11001
|
* According to the Baal Hatanya, _netz amiti_, or true (halachic) sunrise, is when the top of the sun's
|
|
10762
11002
|
* disk is visible at an elevation similar to the mountains of Eretz Yisrael. The time is calculated as the point at which
|
|
10763
|
-
* the center of the sun's disk is 1.
|
|
11003
|
+
* the center of the sun's disk is 1° 35' (1.58333°) below the horizon. This degree-based calculation can be found in Rabbi Shalom
|
|
10764
11004
|
* DovBer Levine's commentary on
|
|
10765
11005
|
* [The Baal Hatanya's Seder Hachnasas Shabbos](https://www.chabadlibrary.org/books/pdf/Seder-Hachnosas-Shabbos.pdf).
|
|
10766
11006
|
* From an elevation of 546 meters, the top of [Har Hacarmel](https://en.wikipedia.org/wiki/Mount_Carmel),
|
|
@@ -10791,7 +11031,7 @@ class Zmanim {
|
|
|
10791
11031
|
*
|
|
10792
11032
|
* According to the Baal Hatanya, _shkiah amiti_, true (_halachic_) sunset, is when the top of the
|
|
10793
11033
|
* sun's disk disappears from view at an elevation similar to the mountains of _Eretz Yisrael_.
|
|
10794
|
-
* This time is calculated as the point at which the center of the sun's disk is 1
|
|
11034
|
+
* This time is calculated as the point at which the center of the sun's disk is 1° 35' below the horizon.
|
|
10795
11035
|
*
|
|
10796
11036
|
* Note: _shkiah amiti_ is used only for calculating certain _zmanim_, and is intentionally unpublished. For
|
|
10797
11037
|
* practical purposes, all daytime mitzvos should be completed before the published time for _shkiah_ / sunset.
|
|
@@ -10859,15 +11099,18 @@ class Zmanim {
|
|
|
10859
11099
|
* [Ra"sh](https://en.wikipedia.org/wiki/Asher_ben_Jehiel),
|
|
10860
11100
|
* [Tur](https://en.wikipedia.org/wiki/Jacob_ben_Asher),
|
|
10861
11101
|
* [GRA](https://en.wikipedia.org/wiki/Vilna_Gaon) and others are of the opinion that _mincha_ can be prayed
|
|
10862
|
-
* _lechatchila_ starting at _mincha gedola_. This is calculated as
|
|
10863
|
-
*
|
|
10864
|
-
* _netz amiti_ (sunrise) to _shkiah amiti_ (sunset).
|
|
11102
|
+
* _lechatchila_ starting at _mincha gedola_. This is calculated as {@link chatzot} (the midpoint of
|
|
11103
|
+
* sea level sunrise and sunset) plus half a solar hour, based on the opinion of the Baal Hatanya that
|
|
11104
|
+
* the day is calculated from _netz amiti_ (sunrise) to _shkiah amiti_ (sunset). This is how Chabad.org
|
|
11105
|
+
* calculates it; 6.5 solar hours after _netz amiti_ differs by under a second, but that is enough to
|
|
11106
|
+
* change the printed minute on a few days a year.
|
|
10865
11107
|
* @return the `Date` of the time of _mincha gedola_ according to the Baal Hatanya. If the calculation
|
|
10866
11108
|
* can't be computed, such as in the Arctic Circle where there is at least one day a year where the sun does not rise
|
|
10867
11109
|
* and one where it does not set, an `Invalid Date` will be returned.
|
|
10868
11110
|
*/
|
|
10869
11111
|
minchaGedolaBaalHatanya() {
|
|
10870
|
-
|
|
11112
|
+
const hour = temporalHourMillis(this.getSunriseBaalHatanya(), this.getSunsetBaalHatanya());
|
|
11113
|
+
return millisToDate(this.chatzotMillis() + hour / 2);
|
|
10871
11114
|
}
|
|
10872
11115
|
/**
|
|
10873
11116
|
* This method returns the time of _mincha ketana_. This is the preferred earliest time to pray
|
|
@@ -11447,7 +11690,7 @@ class HolidayEvent extends Event {
|
|
|
11447
11690
|
/**
|
|
11448
11691
|
* Returns a `https://www.hebcal.com/holidays/...` URL for more detail on
|
|
11449
11692
|
* this holiday. Israel-only holidays get an `?i=on` query parameter.
|
|
11450
|
-
* Returns `undefined` for years outside `[
|
|
11693
|
+
* Returns `undefined` for Gregorian years outside `[1752, 2499]` and for
|
|
11451
11694
|
* Ta'anit BeHaB, which has no holiday page.
|
|
11452
11695
|
*/
|
|
11453
11696
|
url() {
|
|
@@ -11455,7 +11698,7 @@ class HolidayEvent extends Event {
|
|
|
11455
11698
|
return undefined;
|
|
11456
11699
|
}
|
|
11457
11700
|
const year = this.greg().getFullYear();
|
|
11458
|
-
if (year <
|
|
11701
|
+
if (year < 1752 || year > 2499) {
|
|
11459
11702
|
return undefined;
|
|
11460
11703
|
}
|
|
11461
11704
|
const url = `https://www.hebcal.com/holidays/${urlFriendly(this.basename())}-${this.urlDateSuffix()}`;
|
|
@@ -13854,9 +14097,13 @@ class OmerEvent extends Event {
|
|
|
13854
14097
|
}
|
|
13855
14098
|
return str;
|
|
13856
14099
|
}
|
|
14100
|
+
/**
|
|
14101
|
+
* Returns a `https://www.hebcal.com/omer/...` URL, or `undefined` for Hebrew
|
|
14102
|
+
* years outside `[5513, 6260]` (roughly Gregorian 1752–2499).
|
|
14103
|
+
*/
|
|
13857
14104
|
url() {
|
|
13858
14105
|
const year = this.getDate().getFullYear();
|
|
13859
|
-
if (year <
|
|
14106
|
+
if (year < 5513 || year > 6260) {
|
|
13860
14107
|
return undefined;
|
|
13861
14108
|
}
|
|
13862
14109
|
return `https://www.hebcal.com/omer/${year}/${this.omer}`;
|
|
@@ -14032,6 +14279,97 @@ function tachanunYear(year, il) {
|
|
|
14032
14279
|
};
|
|
14033
14280
|
}
|
|
14034
14281
|
|
|
14282
|
+
const NONE = 0;
|
|
14283
|
+
const HALF = 1;
|
|
14284
|
+
const WHOLE = 2;
|
|
14285
|
+
/**
|
|
14286
|
+
* Determines which form of Hallel (if any) is recited
|
|
14287
|
+
* on a given Hebrew date.
|
|
14288
|
+
*
|
|
14289
|
+
* Returns 0 (none), 1 (half Hallel), or 2 (whole Hallel).
|
|
14290
|
+
*
|
|
14291
|
+
* Whole Hallel is said on Chanukah, the first Yom Tov of Pesach, Shavuot, Sukkot,
|
|
14292
|
+
* Shmini Atzeret, Simchat Torah, Yom Ha'atzmaut, and Yom Yerushalayim.
|
|
14293
|
+
*
|
|
14294
|
+
* Half Hallel is said on Rosh Chodesh (not Rosh Hashanah), and the last 6 days of Pesach.
|
|
14295
|
+
* Rosh Chodesh Tevet falls during Chanukah, so whole Hallel is said then.
|
|
14296
|
+
*
|
|
14297
|
+
* The result is computed directly from the Hebrew month and day,
|
|
14298
|
+
* without generating holiday events.
|
|
14299
|
+
* @example
|
|
14300
|
+
* import {hallel, HDate, months} from '@hebcal/core';
|
|
14301
|
+
* hallel(new HDate(25, months.KISLEV, 5784), false); // 2 (Chanukah)
|
|
14302
|
+
* hallel(new HDate(1, months.SHVAT, 5784), false); // 1 (Rosh Chodesh)
|
|
14303
|
+
* hallel(new HDate(2, months.SHVAT, 5784), false); // 0
|
|
14304
|
+
* hallel(new HDate(16, months.NISAN, 5784), false); // 2 (Pesach II, Diaspora)
|
|
14305
|
+
* hallel(new HDate(16, months.NISAN, 5784), true); // 1 (Chol HaMoed, Israel)
|
|
14306
|
+
* @param hdate Hebrew date to test
|
|
14307
|
+
* @param il use the Israeli holiday schedule
|
|
14308
|
+
* @returns 0 for no Hallel, 1 for half Hallel, 2 for whole Hallel
|
|
14309
|
+
*/
|
|
14310
|
+
function hallel(hdate, il) {
|
|
14311
|
+
const mm = hdate.getMonth();
|
|
14312
|
+
const dd = hdate.getDate();
|
|
14313
|
+
switch (mm) {
|
|
14314
|
+
case months.TISHREI:
|
|
14315
|
+
// Sukkot (15-21), Shmini Atzeret (22), Simchat Torah (23, Diaspora)
|
|
14316
|
+
if (dd >= 15 && dd <= (il ? 22 : 23)) {
|
|
14317
|
+
return WHOLE;
|
|
14318
|
+
}
|
|
14319
|
+
break;
|
|
14320
|
+
case months.KISLEV:
|
|
14321
|
+
// Chanukah begins 25 Kislev; the first candle on the evening of
|
|
14322
|
+
// 24 Kislev precedes the first morning of Chanukah
|
|
14323
|
+
if (dd >= 25) {
|
|
14324
|
+
return WHOLE;
|
|
14325
|
+
}
|
|
14326
|
+
break;
|
|
14327
|
+
case months.TEVET: {
|
|
14328
|
+
// Chanukah lasts 8 days, ending on 2 Tevet (3 Tevet if Kislev is short)
|
|
14329
|
+
const lastDay = HDate.shortKislev(hdate.getFullYear()) ? 3 : 2;
|
|
14330
|
+
if (dd <= lastDay) {
|
|
14331
|
+
return WHOLE;
|
|
14332
|
+
}
|
|
14333
|
+
break;
|
|
14334
|
+
}
|
|
14335
|
+
case months.NISAN:
|
|
14336
|
+
// First day(s) of Pesach
|
|
14337
|
+
if (dd === 15 || (dd === 16 && !il)) {
|
|
14338
|
+
return WHOLE;
|
|
14339
|
+
}
|
|
14340
|
+
// Remaining days of Pesach
|
|
14341
|
+
if (dd >= 16 && dd <= (il ? 21 : 22)) {
|
|
14342
|
+
return HALF;
|
|
14343
|
+
}
|
|
14344
|
+
break;
|
|
14345
|
+
case months.IYYAR: {
|
|
14346
|
+
const year = hdate.getFullYear();
|
|
14347
|
+
// Yom Yerushalayim
|
|
14348
|
+
if (dd === 28 && year >= 5727) {
|
|
14349
|
+
return WHOLE;
|
|
14350
|
+
}
|
|
14351
|
+
// Yom Ha'atzmaut, the day after Yom HaZikaron
|
|
14352
|
+
const yomHaZikaron = dateYomHaZikaron(year);
|
|
14353
|
+
if (yomHaZikaron !== null && dd === yomHaZikaron.getDate() + 1) {
|
|
14354
|
+
return WHOLE;
|
|
14355
|
+
}
|
|
14356
|
+
break;
|
|
14357
|
+
}
|
|
14358
|
+
case months.SIVAN:
|
|
14359
|
+
// Shavuot
|
|
14360
|
+
if (dd === 6 || (dd === 7 && !il)) {
|
|
14361
|
+
return WHOLE;
|
|
14362
|
+
}
|
|
14363
|
+
break;
|
|
14364
|
+
}
|
|
14365
|
+
// Rosh Chodesh: the 30th of any month, or the 1st of any month
|
|
14366
|
+
// other than Tishrei (Rosh Hashana)
|
|
14367
|
+
if (dd === 30 || (dd === 1 && mm !== months.TISHREI)) {
|
|
14368
|
+
return HALF;
|
|
14369
|
+
}
|
|
14370
|
+
return NONE;
|
|
14371
|
+
}
|
|
14372
|
+
|
|
14035
14373
|
/** @internal */
|
|
14036
14374
|
function renderParshaName(parsha, locale) {
|
|
14037
14375
|
let name = Locale.gettext(parsha[0], locale);
|
|
@@ -14089,7 +14427,7 @@ class ParshaEvent extends Event {
|
|
|
14089
14427
|
}
|
|
14090
14428
|
url() {
|
|
14091
14429
|
const year = this.greg().getFullYear();
|
|
14092
|
-
if (year <
|
|
14430
|
+
if (year < 1752 || year > 2499) {
|
|
14093
14431
|
return undefined;
|
|
14094
14432
|
}
|
|
14095
14433
|
const dt = this.urlDateSuffix();
|
|
@@ -15145,40 +15483,6 @@ function makeBiurChametzEvent(hd, options) {
|
|
|
15145
15483
|
return biurChametzEv;
|
|
15146
15484
|
}
|
|
15147
15485
|
|
|
15148
|
-
const NONE = 0;
|
|
15149
|
-
const HALF = 1;
|
|
15150
|
-
const WHOLE = 2;
|
|
15151
|
-
/** @internal */
|
|
15152
|
-
function hallel_(events, hdate) {
|
|
15153
|
-
const abs = hdate.abs();
|
|
15154
|
-
for (const ev of events) {
|
|
15155
|
-
const hd = ev.getDate();
|
|
15156
|
-
if (hd.abs() !== abs) {
|
|
15157
|
-
continue;
|
|
15158
|
-
}
|
|
15159
|
-
const desc = ev.getDesc();
|
|
15160
|
-
const month = hd.getMonth();
|
|
15161
|
-
const mday = hd.getDate();
|
|
15162
|
-
if (desc.startsWith('Chanukah') ||
|
|
15163
|
-
desc.startsWith('Shavuot') ||
|
|
15164
|
-
desc.startsWith('Sukkot') ||
|
|
15165
|
-
(month === months.NISAN &&
|
|
15166
|
-
(mday === 15 || mday === 16) &&
|
|
15167
|
-
ev.hasFlag('CHAG')) || // Pesach
|
|
15168
|
-
desc === holidayDesc.YOM_HAATZMA_UT ||
|
|
15169
|
-
desc === holidayDesc.YOM_YERUSHALAYIM) {
|
|
15170
|
-
return WHOLE;
|
|
15171
|
-
}
|
|
15172
|
-
if (ev.hasFlag('ROSH_CHODESH') ||
|
|
15173
|
-
(desc.startsWith('Pesach') &&
|
|
15174
|
-
desc !== holidayDesc.PESACH_I &&
|
|
15175
|
-
desc !== holidayDesc.PESACH_II)) {
|
|
15176
|
-
return HALF;
|
|
15177
|
-
}
|
|
15178
|
-
}
|
|
15179
|
-
return NONE;
|
|
15180
|
-
}
|
|
15181
|
-
|
|
15182
15486
|
/*
|
|
15183
15487
|
Hebcal - A Jewish Calendar Generator
|
|
15184
15488
|
Copyright (c) 1994-2020 Danny Sadinoff
|
|
@@ -15439,15 +15743,9 @@ class HebrewCalendar {
|
|
|
15439
15743
|
return getSedra(hyear, il);
|
|
15440
15744
|
}
|
|
15441
15745
|
/**
|
|
15442
|
-
* Determines which form of Hallel (if any) is recited
|
|
15443
|
-
*
|
|
15444
|
-
*
|
|
15445
|
-
* Returns 0 (none), 1 (half Hallel), or 2 (whole Hallel).
|
|
15446
|
-
*
|
|
15447
|
-
* Whole Hallel is said on Chanukah, the first Yom Tov of Pesach, Shavuot, Sukkot,
|
|
15448
|
-
* Yom Ha'atzmaut, and Yom Yerushalayim.
|
|
15449
|
-
*
|
|
15450
|
-
* Half Hallel is said on Rosh Chodesh (not Rosh Hashanah), and the last 6 days of Pesach.
|
|
15746
|
+
* Determines which form of Hallel (if any) is recited on a given Hebrew date:
|
|
15747
|
+
* 0 (none), 1 (half Hallel), or 2 (whole Hallel).
|
|
15748
|
+
* See {@link hallel} for details.
|
|
15451
15749
|
* @example
|
|
15452
15750
|
* import {HebrewCalendar, HDate, months} from '@hebcal/core';
|
|
15453
15751
|
* HebrewCalendar.hallel(new HDate(25, months.KISLEV, 5784), false); // 2 (Chanukah)
|
|
@@ -15458,11 +15756,7 @@ class HebrewCalendar {
|
|
|
15458
15756
|
* @returns 0 for no Hallel, 1 for half Hallel, 2 for whole Hallel
|
|
15459
15757
|
*/
|
|
15460
15758
|
static hallel(hdate, il) {
|
|
15461
|
-
|
|
15462
|
-
if (!events) {
|
|
15463
|
-
return 0;
|
|
15464
|
-
}
|
|
15465
|
-
return hallel_(events, hdate);
|
|
15759
|
+
return hallel(hdate, il);
|
|
15466
15760
|
}
|
|
15467
15761
|
/**
|
|
15468
15762
|
* Return details on what Tachanun (or Tzidchatcha on Shabbat) is said on `hdate`.
|
|
@@ -15541,6 +15835,7 @@ exports.getHolidaysOnDate = getHolidaysOnDate;
|
|
|
15541
15835
|
exports.getMoladAsDate = getMoladAsDate;
|
|
15542
15836
|
exports.getSedra = getSedra;
|
|
15543
15837
|
exports.greg = greg;
|
|
15838
|
+
exports.hallel = hallel;
|
|
15544
15839
|
exports.holidayDesc = holidayDesc;
|
|
15545
15840
|
exports.isAssurBemlacha = isAssurBemlacha;
|
|
15546
15841
|
exports.isAveilut = isAveilut;
|