@hebcal/core 6.14.2 → 6.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +333 -320
- package/dist/bundle.js.map +1 -1
- package/dist/bundle.min.js +3 -3
- package/dist/bundle.min.js.map +1 -1
- package/dist/esm/DailyLearning.js +1 -1
- package/dist/esm/HebrewDateEvent.js +1 -1
- package/dist/esm/HolidayEvent.js +1 -1
- package/dist/esm/KiddushLevanaEvent.js +1 -1
- package/dist/esm/MevarchimChodeshEvent.js +1 -1
- package/dist/esm/ParshaEvent.js +1 -1
- package/dist/esm/TimedEvent.js +1 -1
- package/dist/esm/YomKippurKatanEvent.js +1 -1
- package/dist/esm/ashkenazi.po.js +1 -1
- package/dist/esm/calendar.js +48 -24
- package/dist/esm/calendar.js.map +1 -1
- package/dist/esm/candles.js +1 -1
- package/dist/esm/cities.json.js +1 -1
- package/dist/esm/event.js +1 -1
- package/dist/esm/getStartAndEnd.js +1 -1
- package/dist/esm/hallel.js +1 -1
- package/dist/esm/he-x-NoNikud.po.js +1 -1
- package/dist/esm/he.po.js +1 -1
- package/dist/esm/hebcal.js +1 -1
- package/dist/esm/holidays.d.ts +19 -0
- package/dist/esm/holidays.js +38 -9
- package/dist/esm/holidays.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/isAssurBemlacha.js +1 -1
- package/dist/esm/isAveilut.js +1 -1
- package/dist/esm/isFastDay.js +1 -1
- package/dist/esm/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.js +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.js +1 -1
- package/dist/esm/zmanim.js +1 -1
- package/package.json +6 -6
package/dist/bundle.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/*! @hebcal/core v6.14.
|
|
1
|
+
/*! @hebcal/core v6.14.3, 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.14.
|
|
6
|
+
const version = '6.14.3';
|
|
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
|
/**
|
|
@@ -2961,259 +2961,6 @@ function requireObjectLike(arg) {
|
|
|
2961
2961
|
return arg;
|
|
2962
2962
|
}
|
|
2963
2963
|
|
|
2964
|
-
function normalizeOptionsOrString(options, optionName) {
|
|
2965
|
-
return "string" == typeof options ? ((optionName, optionVal) => {
|
|
2966
|
-
const res = Object.create(null);
|
|
2967
|
-
return res[optionName] = optionVal, res;
|
|
2968
|
-
})(optionName, options) : requireObjectLike(options);
|
|
2969
|
-
}
|
|
2970
|
-
|
|
2971
|
-
const smallestUnitStr = "smallestUnit";
|
|
2972
|
-
|
|
2973
|
-
const overflowMap = {
|
|
2974
|
-
constrain: 0,
|
|
2975
|
-
reject: 1
|
|
2976
|
-
};
|
|
2977
|
-
|
|
2978
|
-
const epochDisambigMap = {
|
|
2979
|
-
compatible: 0,
|
|
2980
|
-
reject: 1,
|
|
2981
|
-
earlier: 2,
|
|
2982
|
-
later: 3
|
|
2983
|
-
};
|
|
2984
|
-
|
|
2985
|
-
const offsetDisambigMap = {
|
|
2986
|
-
reject: 0,
|
|
2987
|
-
use: 1,
|
|
2988
|
-
prefer: 2,
|
|
2989
|
-
ignore: 3
|
|
2990
|
-
};
|
|
2991
|
-
|
|
2992
|
-
const calendarDisplayMap = {
|
|
2993
|
-
auto: 0,
|
|
2994
|
-
never: 1,
|
|
2995
|
-
critical: 2,
|
|
2996
|
-
always: 3
|
|
2997
|
-
};
|
|
2998
|
-
|
|
2999
|
-
const timeZoneDisplayMap = {
|
|
3000
|
-
auto: 0,
|
|
3001
|
-
never: 1,
|
|
3002
|
-
critical: 2
|
|
3003
|
-
};
|
|
3004
|
-
|
|
3005
|
-
const offsetDisplayMap = {
|
|
3006
|
-
auto: 0,
|
|
3007
|
-
never: 1
|
|
3008
|
-
};
|
|
3009
|
-
|
|
3010
|
-
const roundingModeMap = {
|
|
3011
|
-
floor: 0,
|
|
3012
|
-
halfFloor: 1,
|
|
3013
|
-
ceil: 2,
|
|
3014
|
-
halfCeil: 3,
|
|
3015
|
-
trunc: 4,
|
|
3016
|
-
halfTrunc: 5,
|
|
3017
|
-
expand: 6,
|
|
3018
|
-
halfExpand: 7,
|
|
3019
|
-
halfEven: 8
|
|
3020
|
-
};
|
|
3021
|
-
|
|
3022
|
-
const roundingModeFuncs = [ Math.floor, roundHalfFloor, Math.ceil, roundHalfCeil, Math.trunc, roundHalfTrunc, roundExpand, roundHalfExpand, roundHalfEven ];
|
|
3023
|
-
|
|
3024
|
-
const directionMap = {
|
|
3025
|
-
previous: -1,
|
|
3026
|
-
next: 1
|
|
3027
|
-
};
|
|
3028
|
-
|
|
3029
|
-
function coerceRoundingIncInteger(options) {
|
|
3030
|
-
const roundingInc = options.roundingIncrement;
|
|
3031
|
-
return void 0 === roundingInc ? 1 : toIntegerWithTrunc(roundingInc, "roundingIncrement");
|
|
3032
|
-
}
|
|
3033
|
-
|
|
3034
|
-
function coerceFractionalSecondDigits(options) {
|
|
3035
|
-
let subsecDigits = options.fractionalSecondDigits;
|
|
3036
|
-
if (void 0 !== subsecDigits) {
|
|
3037
|
-
if ("number" != typeof subsecDigits) {
|
|
3038
|
-
if ("auto" === toString(subsecDigits)) {
|
|
3039
|
-
return;
|
|
3040
|
-
}
|
|
3041
|
-
throwRangeError(invalidEntity("fractionalSecondDigits", subsecDigits));
|
|
3042
|
-
}
|
|
3043
|
-
subsecDigits = clampEntity("fractionalSecondDigits", Math.floor(subsecDigits), 0, 9, 1);
|
|
3044
|
-
}
|
|
3045
|
-
return subsecDigits;
|
|
3046
|
-
}
|
|
3047
|
-
|
|
3048
|
-
function coerceUnitOption(optionName, options, minUnit = 0, ensureDefined) {
|
|
3049
|
-
let unitStr = options[optionName];
|
|
3050
|
-
if (void 0 === unitStr) {
|
|
3051
|
-
return ensureDefined ? minUnit : void 0;
|
|
3052
|
-
}
|
|
3053
|
-
if (unitStr = toString(unitStr), "auto" === unitStr) {
|
|
3054
|
-
return ensureDefined ? minUnit : null;
|
|
3055
|
-
}
|
|
3056
|
-
let unit = unitNameMap[unitStr];
|
|
3057
|
-
return void 0 === unit && (unit = durationFieldNamesAsc.indexOf(unitStr)), unit < 0 && throwRangeError(invalidChoice(optionName, unitStr, unitNameMap)),
|
|
3058
|
-
unit;
|
|
3059
|
-
}
|
|
3060
|
-
|
|
3061
|
-
function coerceChoiceOption(optionName, enumNameMap, options, defaultChoice = 0) {
|
|
3062
|
-
const enumArg = options[optionName];
|
|
3063
|
-
if (void 0 === enumArg) {
|
|
3064
|
-
return defaultChoice;
|
|
3065
|
-
}
|
|
3066
|
-
const enumStr = toString(enumArg);
|
|
3067
|
-
const enumNum = enumNameMap[enumStr];
|
|
3068
|
-
return void 0 === enumNum && throwRangeError(invalidChoice(optionName, enumStr, enumNameMap)),
|
|
3069
|
-
enumNum;
|
|
3070
|
-
}
|
|
3071
|
-
|
|
3072
|
-
const coerceSmallestUnit = /*@__PURE__*/ bindArgs(coerceUnitOption, smallestUnitStr);
|
|
3073
|
-
|
|
3074
|
-
const coerceLargestUnit = /*@__PURE__*/ bindArgs(coerceUnitOption, "largestUnit");
|
|
3075
|
-
|
|
3076
|
-
const coerceTotalUnit = /*@__PURE__*/ bindArgs(coerceUnitOption, "unit");
|
|
3077
|
-
|
|
3078
|
-
const coerceOverflow = /*@__PURE__*/ bindArgs(coerceChoiceOption, "overflow", overflowMap);
|
|
3079
|
-
|
|
3080
|
-
const coerceEpochDisambig = /*@__PURE__*/ bindArgs(coerceChoiceOption, "disambiguation", epochDisambigMap);
|
|
3081
|
-
|
|
3082
|
-
const coerceOffsetDisambig = /*@__PURE__*/ bindArgs(coerceChoiceOption, "offset", offsetDisambigMap);
|
|
3083
|
-
|
|
3084
|
-
const coerceCalendarDisplay = /*@__PURE__*/ bindArgs(coerceChoiceOption, "calendarName", calendarDisplayMap);
|
|
3085
|
-
|
|
3086
|
-
const coerceTimeZoneDisplay = /*@__PURE__*/ bindArgs(coerceChoiceOption, "timeZoneName", timeZoneDisplayMap);
|
|
3087
|
-
|
|
3088
|
-
const coerceOffsetDisplay = /*@__PURE__*/ bindArgs(coerceChoiceOption, "offset", offsetDisplayMap);
|
|
3089
|
-
|
|
3090
|
-
const coerceRoundingMode = /*@__PURE__*/ bindArgs(coerceChoiceOption, "roundingMode", roundingModeMap);
|
|
3091
|
-
|
|
3092
|
-
const coerceDirection = /*@__PURE__*/ bindArgs(coerceChoiceOption, "direction", directionMap);
|
|
3093
|
-
|
|
3094
|
-
function validateRoundingInc(roundingInc, smallestUnit, allowManyLargeUnits, solarMode) {
|
|
3095
|
-
const upUnitNano = solarMode ? nanoInUtcDay : unitNanoMap[smallestUnit + 1];
|
|
3096
|
-
if (upUnitNano) {
|
|
3097
|
-
const unitNano = unitNanoMap[smallestUnit];
|
|
3098
|
-
upUnitNano % ((roundingInc = clampEntity("roundingIncrement", roundingInc, 1, upUnitNano / unitNano - (solarMode ? 0 : 1), 1)) * unitNano) && throwRangeError(invalidEntity("roundingIncrement", roundingInc));
|
|
3099
|
-
} else {
|
|
3100
|
-
roundingInc = clampEntity("roundingIncrement", roundingInc, 1, allowManyLargeUnits ? 10 ** 9 : 1, 1);
|
|
3101
|
-
}
|
|
3102
|
-
return roundingInc;
|
|
3103
|
-
}
|
|
3104
|
-
|
|
3105
|
-
function validateUnitRange(optionName, unit, minUnit, maxUnit) {
|
|
3106
|
-
return null != unit && clampEntity(optionName, unit, minUnit, maxUnit, 1, unitNamesAsc),
|
|
3107
|
-
unit;
|
|
3108
|
-
}
|
|
3109
|
-
|
|
3110
|
-
function checkLargestSmallestUnit(largestUnit, smallestUnit) {
|
|
3111
|
-
smallestUnit > largestUnit && throwRangeError(flippedSmallestLargestUnit);
|
|
3112
|
-
}
|
|
3113
|
-
|
|
3114
|
-
function refineDiffOptions(roundingModeInvert, options, defaultLargestUnit, maxUnit = 9, minUnit = 0, defaultRoundingMode = 4) {
|
|
3115
|
-
options = normalizeOptions(options);
|
|
3116
|
-
let largestUnit = coerceLargestUnit(options, minUnit);
|
|
3117
|
-
let roundingInc = coerceRoundingIncInteger(options);
|
|
3118
|
-
let roundingMode = coerceRoundingMode(options, defaultRoundingMode);
|
|
3119
|
-
let smallestUnit = coerceSmallestUnit(options, minUnit, 1);
|
|
3120
|
-
return largestUnit = validateUnitRange("largestUnit", largestUnit, minUnit, maxUnit),
|
|
3121
|
-
smallestUnit = validateUnitRange(smallestUnitStr, smallestUnit, minUnit, maxUnit),
|
|
3122
|
-
null == largestUnit ? largestUnit = Math.max(defaultLargestUnit, smallestUnit) : checkLargestSmallestUnit(largestUnit, smallestUnit),
|
|
3123
|
-
roundingInc = validateRoundingInc(roundingInc, smallestUnit, 1), roundingModeInvert && (roundingMode = (roundingMode => roundingMode < 4 ? (roundingMode + 2) % 4 : roundingMode)(roundingMode)),
|
|
3124
|
-
[ largestUnit, smallestUnit, roundingInc, roundingMode ];
|
|
3125
|
-
}
|
|
3126
|
-
|
|
3127
|
-
function refineDurationRoundOptions(options, defaultLargestUnit, refineRelativeTo) {
|
|
3128
|
-
options = normalizeOptionsOrString(options, smallestUnitStr);
|
|
3129
|
-
let largestUnit = coerceLargestUnit(options);
|
|
3130
|
-
const relativeToInternals = refineRelativeTo(options.relativeTo);
|
|
3131
|
-
let roundingInc = coerceRoundingIncInteger(options);
|
|
3132
|
-
const roundingMode = coerceRoundingMode(options, 7);
|
|
3133
|
-
let smallestUnit = coerceSmallestUnit(options);
|
|
3134
|
-
return void 0 === largestUnit && void 0 === smallestUnit && throwRangeError(missingSmallestLargestUnit),
|
|
3135
|
-
null == smallestUnit && (smallestUnit = 0), null == largestUnit && (largestUnit = Math.max(smallestUnit, defaultLargestUnit)),
|
|
3136
|
-
checkLargestSmallestUnit(largestUnit, smallestUnit), roundingInc = validateRoundingInc(roundingInc, smallestUnit, 1),
|
|
3137
|
-
roundingInc > 1 && smallestUnit > 5 && largestUnit !== smallestUnit && throwRangeError("For calendar units with roundingIncrement > 1, use largestUnit = smallestUnit"),
|
|
3138
|
-
[ largestUnit, smallestUnit, roundingInc, roundingMode, relativeToInternals ];
|
|
3139
|
-
}
|
|
3140
|
-
|
|
3141
|
-
function refineRoundingOptions(options, maxUnit = 6, solarMode) {
|
|
3142
|
-
let roundingInc = coerceRoundingIncInteger(options = normalizeOptionsOrString(options, smallestUnitStr));
|
|
3143
|
-
const roundingMode = coerceRoundingMode(options, 7);
|
|
3144
|
-
let smallestUnit = coerceSmallestUnit(options);
|
|
3145
|
-
return smallestUnit = requirePropDefined(smallestUnitStr, smallestUnit), smallestUnit = validateUnitRange(smallestUnitStr, smallestUnit, 0, maxUnit),
|
|
3146
|
-
roundingInc = validateRoundingInc(roundingInc, smallestUnit, void 0, solarMode),
|
|
3147
|
-
[ smallestUnit, roundingInc, roundingMode ];
|
|
3148
|
-
}
|
|
3149
|
-
|
|
3150
|
-
function refineTotalOptions(options, refineRelativeTo) {
|
|
3151
|
-
const relativeToInternals = refineRelativeTo((options = normalizeOptionsOrString(options, "unit")).relativeTo);
|
|
3152
|
-
let totalUnit = coerceTotalUnit(options);
|
|
3153
|
-
return totalUnit = requirePropDefined("unit", totalUnit), [ totalUnit, relativeToInternals ];
|
|
3154
|
-
}
|
|
3155
|
-
|
|
3156
|
-
function refineOverflowOptions(options) {
|
|
3157
|
-
return void 0 === options ? 0 : coerceOverflow(requireObjectLike(options));
|
|
3158
|
-
}
|
|
3159
|
-
|
|
3160
|
-
function refineZonedFieldOptions(options, defaultOffsetDisambig = 0) {
|
|
3161
|
-
options = normalizeOptions(options);
|
|
3162
|
-
const epochDisambig = coerceEpochDisambig(options);
|
|
3163
|
-
const offsetDisambig = coerceOffsetDisambig(options, defaultOffsetDisambig);
|
|
3164
|
-
return [ coerceOverflow(options), offsetDisambig, epochDisambig ];
|
|
3165
|
-
}
|
|
3166
|
-
|
|
3167
|
-
function refineEpochDisambigOptions(options) {
|
|
3168
|
-
return coerceEpochDisambig(normalizeOptions(options));
|
|
3169
|
-
}
|
|
3170
|
-
|
|
3171
|
-
function refineTimeDisplayTuple(options, maxSmallestUnit = 4) {
|
|
3172
|
-
const subsecDigits = coerceFractionalSecondDigits(options);
|
|
3173
|
-
const roundingMode = coerceRoundingMode(options, 4);
|
|
3174
|
-
const smallestUnit = coerceSmallestUnit(options);
|
|
3175
|
-
return [ roundingMode, ...resolveSmallestUnitAndSubsecDigits(validateUnitRange(smallestUnitStr, smallestUnit, 0, maxSmallestUnit), subsecDigits) ];
|
|
3176
|
-
}
|
|
3177
|
-
|
|
3178
|
-
function refineDateTimeDisplayOptions(options) {
|
|
3179
|
-
return options = normalizeOptions(options), [ coerceCalendarDisplay(options), ...refineTimeDisplayTuple(options) ];
|
|
3180
|
-
}
|
|
3181
|
-
|
|
3182
|
-
function refineDateDisplayOptions(options) {
|
|
3183
|
-
return coerceCalendarDisplay(normalizeOptions(options));
|
|
3184
|
-
}
|
|
3185
|
-
|
|
3186
|
-
function refineTimeDisplayOptions(options, maxSmallestUnit) {
|
|
3187
|
-
return refineTimeDisplayTuple(normalizeOptions(options), maxSmallestUnit);
|
|
3188
|
-
}
|
|
3189
|
-
|
|
3190
|
-
function refineZonedDateTimeDisplayOptions(options) {
|
|
3191
|
-
options = normalizeOptions(options);
|
|
3192
|
-
const calendarDisplay = coerceCalendarDisplay(options);
|
|
3193
|
-
const subsecDigits = coerceFractionalSecondDigits(options);
|
|
3194
|
-
const offsetDisplay = coerceOffsetDisplay(options);
|
|
3195
|
-
const roundingMode = coerceRoundingMode(options, 4);
|
|
3196
|
-
const smallestUnit = coerceSmallestUnit(options);
|
|
3197
|
-
return [ calendarDisplay, coerceTimeZoneDisplay(options), offsetDisplay, roundingMode, ...resolveSmallestUnitAndSubsecDigits(validateUnitRange(smallestUnitStr, smallestUnit, 0, 4), subsecDigits) ];
|
|
3198
|
-
}
|
|
3199
|
-
|
|
3200
|
-
function refineInstantDisplayOptions(options) {
|
|
3201
|
-
const subsecDigits = coerceFractionalSecondDigits(options = normalizeOptions(options));
|
|
3202
|
-
const roundingMode = coerceRoundingMode(options, 4);
|
|
3203
|
-
const smallestUnit = coerceSmallestUnit(options);
|
|
3204
|
-
return [ options.timeZone, roundingMode, ...resolveSmallestUnitAndSubsecDigits(validateUnitRange(smallestUnitStr, smallestUnit, 0, 4), subsecDigits) ];
|
|
3205
|
-
}
|
|
3206
|
-
|
|
3207
|
-
function resolveSmallestUnitAndSubsecDigits(smallestUnit, subsecDigits) {
|
|
3208
|
-
return null != smallestUnit ? [ unitNanoMap[smallestUnit], smallestUnit < 4 ? 9 - 3 * smallestUnit : -1 ] : [ void 0 === subsecDigits ? 1 : 10 ** (9 - subsecDigits), subsecDigits ];
|
|
3209
|
-
}
|
|
3210
|
-
|
|
3211
|
-
function refineDirectionOptions(options) {
|
|
3212
|
-
const normalizedOptions = normalizeOptionsOrString(options, "direction");
|
|
3213
|
-
const res = coerceDirection(normalizedOptions, 0);
|
|
3214
|
-
return res || throwRangeError(invalidEntity("direction", res)), res;
|
|
3215
|
-
}
|
|
3216
|
-
|
|
3217
2964
|
const invalidEntity = invalidEntity$1;
|
|
3218
2965
|
|
|
3219
2966
|
const missingField = fieldName => `Missing ${fieldName}`;
|
|
@@ -3240,10 +2987,6 @@ const invalidTimeZone = calendarId => invalidEntity$1("TimeZone", calendarId);
|
|
|
3240
2987
|
|
|
3241
2988
|
const outOfBoundsDate = "Out-of-bounds date";
|
|
3242
2989
|
|
|
3243
|
-
const missingSmallestLargestUnit = "Required smallestUnit or largestUnit";
|
|
3244
|
-
|
|
3245
|
-
const flippedSmallestLargestUnit = "smallestUnit > largestUnit";
|
|
3246
|
-
|
|
3247
2990
|
const failedParse = s => `Cannot parse: ${s}`;
|
|
3248
2991
|
|
|
3249
2992
|
const invalidSubstring = substring => `Invalid substring: ${substring}`;
|
|
@@ -3429,34 +3172,10 @@ function modTrunc(num, divisor) {
|
|
|
3429
3172
|
return num % divisor || 0;
|
|
3430
3173
|
}
|
|
3431
3174
|
|
|
3432
|
-
function roundExpand(num) {
|
|
3433
|
-
return num < 0 ? Math.floor(num) : Math.ceil(num);
|
|
3434
|
-
}
|
|
3435
|
-
|
|
3436
3175
|
function fabricateNearHalfFraction(halfCompare, sign = 1) {
|
|
3437
3176
|
return sign * (.5 + halfCompare / 5);
|
|
3438
3177
|
}
|
|
3439
3178
|
|
|
3440
|
-
function roundHalfExpand(num) {
|
|
3441
|
-
return Math.sign(num) * Math.round(Math.abs(num)) || 0;
|
|
3442
|
-
}
|
|
3443
|
-
|
|
3444
|
-
function roundHalfFloor(num) {
|
|
3445
|
-
return hasHalf(num) ? Math.floor(num) : Math.round(num);
|
|
3446
|
-
}
|
|
3447
|
-
|
|
3448
|
-
function roundHalfCeil(num) {
|
|
3449
|
-
return hasHalf(num) ? Math.ceil(num) : Math.round(num);
|
|
3450
|
-
}
|
|
3451
|
-
|
|
3452
|
-
function roundHalfTrunc(num) {
|
|
3453
|
-
return hasHalf(num) ? Math.trunc(num) || 0 : Math.round(num);
|
|
3454
|
-
}
|
|
3455
|
-
|
|
3456
|
-
function roundHalfEven(num) {
|
|
3457
|
-
return hasHalf(num) ? (num = Math.trunc(num) || 0) + num % 2 : Math.round(num);
|
|
3458
|
-
}
|
|
3459
|
-
|
|
3460
3179
|
function hasHalf(num) {
|
|
3461
3180
|
return .5 === Math.abs(num % 1);
|
|
3462
3181
|
}
|
|
@@ -3961,6 +3680,178 @@ function toStrictInteger(arg, entityName) {
|
|
|
3961
3680
|
return requireNumberIsInteger(toFiniteNumber(arg, entityName), entityName);
|
|
3962
3681
|
}
|
|
3963
3682
|
|
|
3683
|
+
const smallestUnitStr = "smallestUnit";
|
|
3684
|
+
|
|
3685
|
+
const overflowMap = {
|
|
3686
|
+
constrain: 0,
|
|
3687
|
+
reject: 1
|
|
3688
|
+
};
|
|
3689
|
+
|
|
3690
|
+
const epochDisambigMap = {
|
|
3691
|
+
compatible: 0,
|
|
3692
|
+
reject: 1,
|
|
3693
|
+
earlier: 2,
|
|
3694
|
+
later: 3
|
|
3695
|
+
};
|
|
3696
|
+
|
|
3697
|
+
const offsetDisambigMap = {
|
|
3698
|
+
reject: 0,
|
|
3699
|
+
use: 1,
|
|
3700
|
+
prefer: 2,
|
|
3701
|
+
ignore: 3
|
|
3702
|
+
};
|
|
3703
|
+
|
|
3704
|
+
const calendarDisplayMap = {
|
|
3705
|
+
auto: 0,
|
|
3706
|
+
never: 1,
|
|
3707
|
+
critical: 2,
|
|
3708
|
+
always: 3
|
|
3709
|
+
};
|
|
3710
|
+
|
|
3711
|
+
const timeZoneDisplayMap = {
|
|
3712
|
+
auto: 0,
|
|
3713
|
+
never: 1,
|
|
3714
|
+
critical: 2
|
|
3715
|
+
};
|
|
3716
|
+
|
|
3717
|
+
const offsetDisplayMap = {
|
|
3718
|
+
auto: 0,
|
|
3719
|
+
never: 1
|
|
3720
|
+
};
|
|
3721
|
+
|
|
3722
|
+
const roundingModeMap = {
|
|
3723
|
+
floor: 0,
|
|
3724
|
+
halfFloor: 1,
|
|
3725
|
+
ceil: 2,
|
|
3726
|
+
halfCeil: 3,
|
|
3727
|
+
trunc: 4,
|
|
3728
|
+
halfTrunc: 5,
|
|
3729
|
+
expand: 6,
|
|
3730
|
+
halfExpand: 7,
|
|
3731
|
+
halfEven: 8
|
|
3732
|
+
};
|
|
3733
|
+
|
|
3734
|
+
const roundingModeFuncs = [ Math.floor, num => hasHalf(num) ? Math.floor(num) : Math.round(num), Math.ceil, num => hasHalf(num) ? Math.ceil(num) : Math.round(num), Math.trunc, num => hasHalf(num) ? Math.trunc(num) || 0 : Math.round(num), num => num < 0 ? Math.floor(num) : Math.ceil(num), num => Math.sign(num) * Math.round(Math.abs(num)) || 0, num => hasHalf(num) ? (num = Math.trunc(num) || 0) + num % 2 : Math.round(num) ];
|
|
3735
|
+
|
|
3736
|
+
const directionMap = {
|
|
3737
|
+
previous: -1,
|
|
3738
|
+
next: 1
|
|
3739
|
+
};
|
|
3740
|
+
|
|
3741
|
+
function coerceRoundingIncInteger(options) {
|
|
3742
|
+
const roundingInc = options.roundingIncrement;
|
|
3743
|
+
return void 0 === roundingInc ? 1 : toIntegerWithTrunc(roundingInc, "roundingIncrement");
|
|
3744
|
+
}
|
|
3745
|
+
|
|
3746
|
+
function coerceFractionalSecondDigits(options) {
|
|
3747
|
+
let subsecDigits = options.fractionalSecondDigits;
|
|
3748
|
+
if (void 0 !== subsecDigits) {
|
|
3749
|
+
if ("number" != typeof subsecDigits) {
|
|
3750
|
+
if ("auto" === toString(subsecDigits)) {
|
|
3751
|
+
return;
|
|
3752
|
+
}
|
|
3753
|
+
throwRangeError(invalidEntity("fractionalSecondDigits", subsecDigits));
|
|
3754
|
+
}
|
|
3755
|
+
subsecDigits = clampEntity("fractionalSecondDigits", Math.floor(subsecDigits), 0, 9, 1);
|
|
3756
|
+
}
|
|
3757
|
+
return subsecDigits;
|
|
3758
|
+
}
|
|
3759
|
+
|
|
3760
|
+
function coerceUnitOption(optionName, options, minUnit = 0, ensureDefined) {
|
|
3761
|
+
let unitStr = options[optionName];
|
|
3762
|
+
if (void 0 === unitStr) {
|
|
3763
|
+
return ensureDefined ? minUnit : void 0;
|
|
3764
|
+
}
|
|
3765
|
+
if (unitStr = toString(unitStr), "auto" === unitStr) {
|
|
3766
|
+
return ensureDefined ? minUnit : null;
|
|
3767
|
+
}
|
|
3768
|
+
let unit = unitNameMap[unitStr];
|
|
3769
|
+
return void 0 === unit && (unit = durationFieldNamesAsc.indexOf(unitStr)), unit < 0 && throwRangeError(invalidChoice(optionName, unitStr, unitNameMap)),
|
|
3770
|
+
unit;
|
|
3771
|
+
}
|
|
3772
|
+
|
|
3773
|
+
function coerceChoiceOption(optionName, enumNameMap, options, defaultChoice = 0) {
|
|
3774
|
+
const enumArg = options[optionName];
|
|
3775
|
+
if (void 0 === enumArg) {
|
|
3776
|
+
return defaultChoice;
|
|
3777
|
+
}
|
|
3778
|
+
const enumStr = toString(enumArg);
|
|
3779
|
+
const enumNum = enumNameMap[enumStr];
|
|
3780
|
+
return void 0 === enumNum && throwRangeError(invalidChoice(optionName, enumStr, enumNameMap)),
|
|
3781
|
+
enumNum;
|
|
3782
|
+
}
|
|
3783
|
+
|
|
3784
|
+
const coerceSmallestUnit = /*@__PURE__*/ bindArgs(coerceUnitOption, smallestUnitStr);
|
|
3785
|
+
|
|
3786
|
+
const coerceLargestUnit = /*@__PURE__*/ bindArgs(coerceUnitOption, "largestUnit");
|
|
3787
|
+
|
|
3788
|
+
const coerceTotalUnit = /*@__PURE__*/ bindArgs(coerceUnitOption, "unit");
|
|
3789
|
+
|
|
3790
|
+
const coerceOverflow = /*@__PURE__*/ bindArgs(coerceChoiceOption, "overflow", overflowMap);
|
|
3791
|
+
|
|
3792
|
+
const coerceEpochDisambig = /*@__PURE__*/ bindArgs(coerceChoiceOption, "disambiguation", epochDisambigMap);
|
|
3793
|
+
|
|
3794
|
+
const coerceOffsetDisambig = /*@__PURE__*/ bindArgs(coerceChoiceOption, "offset", offsetDisambigMap);
|
|
3795
|
+
|
|
3796
|
+
const coerceCalendarDisplay = /*@__PURE__*/ bindArgs(coerceChoiceOption, "calendarName", calendarDisplayMap);
|
|
3797
|
+
|
|
3798
|
+
const coerceTimeZoneDisplay = /*@__PURE__*/ bindArgs(coerceChoiceOption, "timeZoneName", timeZoneDisplayMap);
|
|
3799
|
+
|
|
3800
|
+
const coerceOffsetDisplay = /*@__PURE__*/ bindArgs(coerceChoiceOption, "offset", offsetDisplayMap);
|
|
3801
|
+
|
|
3802
|
+
const coerceRoundingMode = /*@__PURE__*/ bindArgs(coerceChoiceOption, "roundingMode", roundingModeMap);
|
|
3803
|
+
|
|
3804
|
+
const coerceDirection = /*@__PURE__*/ bindArgs(coerceChoiceOption, "direction", directionMap);
|
|
3805
|
+
|
|
3806
|
+
function normalizeOptionsOrString(options, optionName) {
|
|
3807
|
+
return "string" == typeof options ? ((optionName, optionVal) => {
|
|
3808
|
+
const res = Object.create(null);
|
|
3809
|
+
return res[optionName] = optionVal, res;
|
|
3810
|
+
})(optionName, options) : requireObjectLike(options);
|
|
3811
|
+
}
|
|
3812
|
+
|
|
3813
|
+
function validateRoundingInc(roundingInc, smallestUnit, allowManyLargeUnits, solarMode) {
|
|
3814
|
+
const upUnitNano = solarMode ? nanoInUtcDay : unitNanoMap[smallestUnit + 1];
|
|
3815
|
+
if (upUnitNano) {
|
|
3816
|
+
const unitNano = unitNanoMap[smallestUnit];
|
|
3817
|
+
upUnitNano % ((roundingInc = clampEntity("roundingIncrement", roundingInc, 1, upUnitNano / unitNano - (solarMode ? 0 : 1), 1)) * unitNano) && throwRangeError(invalidEntity("roundingIncrement", roundingInc));
|
|
3818
|
+
} else {
|
|
3819
|
+
roundingInc = clampEntity("roundingIncrement", roundingInc, 1, allowManyLargeUnits ? 10 ** 9 : 1, 1);
|
|
3820
|
+
}
|
|
3821
|
+
return roundingInc;
|
|
3822
|
+
}
|
|
3823
|
+
|
|
3824
|
+
function validateUnitRange(optionName, unit, minUnit, maxUnit) {
|
|
3825
|
+
return null != unit && clampEntity(optionName, unit, minUnit, maxUnit, 1, unitNamesAsc),
|
|
3826
|
+
unit;
|
|
3827
|
+
}
|
|
3828
|
+
|
|
3829
|
+
function checkLargestSmallestUnit(largestUnit, smallestUnit) {
|
|
3830
|
+
smallestUnit > largestUnit && throwRangeError("smallestUnit > largestUnit");
|
|
3831
|
+
}
|
|
3832
|
+
|
|
3833
|
+
function refineDiffOptions(roundingModeInvert, options, defaultLargestUnit, maxUnit = 9, minUnit = 0, defaultRoundingMode = 4) {
|
|
3834
|
+
options = normalizeOptions(options);
|
|
3835
|
+
let largestUnit = coerceLargestUnit(options, minUnit);
|
|
3836
|
+
let roundingInc = coerceRoundingIncInteger(options);
|
|
3837
|
+
let roundingMode = coerceRoundingMode(options, defaultRoundingMode);
|
|
3838
|
+
let smallestUnit = coerceSmallestUnit(options, minUnit, 1);
|
|
3839
|
+
return largestUnit = validateUnitRange("largestUnit", largestUnit, minUnit, maxUnit),
|
|
3840
|
+
smallestUnit = validateUnitRange(smallestUnitStr, smallestUnit, minUnit, maxUnit),
|
|
3841
|
+
null == largestUnit ? largestUnit = Math.max(defaultLargestUnit, smallestUnit) : checkLargestSmallestUnit(largestUnit, smallestUnit),
|
|
3842
|
+
roundingInc = validateRoundingInc(roundingInc, smallestUnit, 1), roundingModeInvert && (roundingMode = (roundingMode => roundingMode < 4 ? (roundingMode + 2) % 4 : roundingMode)(roundingMode)),
|
|
3843
|
+
[ largestUnit, smallestUnit, roundingInc, roundingMode ];
|
|
3844
|
+
}
|
|
3845
|
+
|
|
3846
|
+
function refineRoundingOptions(options, maxUnit = 6, solarMode) {
|
|
3847
|
+
let roundingInc = coerceRoundingIncInteger(options = normalizeOptionsOrString(options, smallestUnitStr));
|
|
3848
|
+
const roundingMode = coerceRoundingMode(options, 7);
|
|
3849
|
+
let smallestUnit = coerceSmallestUnit(options);
|
|
3850
|
+
return smallestUnit = requirePropDefined(smallestUnitStr, smallestUnit), smallestUnit = validateUnitRange(smallestUnitStr, smallestUnit, 0, maxUnit),
|
|
3851
|
+
roundingInc = validateRoundingInc(roundingInc, smallestUnit, void 0, solarMode),
|
|
3852
|
+
[ smallestUnit, roundingInc, roundingMode ];
|
|
3853
|
+
}
|
|
3854
|
+
|
|
3964
3855
|
function combineDateAndTime(isoDate, time) {
|
|
3965
3856
|
return pluckProps(calendarDateFieldNamesAsc, isoDate, pluckProps(timeFieldNamesAsc, time));
|
|
3966
3857
|
}
|
|
@@ -4308,7 +4199,7 @@ function getStartOfDayInstantFor(timeZone, isoDateTime) {
|
|
|
4308
4199
|
}
|
|
4309
4200
|
|
|
4310
4201
|
function moveYearMonth(calendar, isoDate, durationSlots, overflow = 0) {
|
|
4311
|
-
computeDurationSign(durationSlots) && getMaxDurationUnit(durationSlots)
|
|
4202
|
+
computeDurationSign(durationSlots) && clampEntity("unit", getMaxDurationUnit(durationSlots), 8, 9, 1, durationFieldNamesAsc);
|
|
4312
4203
|
const first = checkIsoDateInBounds(moveToStartOfMonth(calendar, isoDate));
|
|
4313
4204
|
return moveToStartOfMonth(calendar, moveDate(calendar, first, durationSlots, overflow));
|
|
4314
4205
|
}
|
|
@@ -4346,7 +4237,7 @@ function moveTime(timeFields, durationFields) {
|
|
|
4346
4237
|
}
|
|
4347
4238
|
|
|
4348
4239
|
function moveEpochNano(epochNano, durationFields) {
|
|
4349
|
-
return moveEpochNanoByNano(epochNano, (
|
|
4240
|
+
return moveEpochNanoByNano(epochNano, (clampEntity("unit", getMaxDurationUnit(fields = durationFields), 0, 5, 1, durationFieldNamesAsc),
|
|
4350
4241
|
durationTimeToBigNano(fields)));
|
|
4351
4242
|
var fields;
|
|
4352
4243
|
}
|
|
@@ -4692,7 +4583,7 @@ const maxDurationSeconds = 2 ** 53;
|
|
|
4692
4583
|
|
|
4693
4584
|
function addDurationsWithoutRelativeTo(doSubtract, slots, otherSlots) {
|
|
4694
4585
|
const maxUnit = Math.max(getMaxDurationUnit(slots), getMaxDurationUnit(otherSlots));
|
|
4695
|
-
return maxUnit
|
|
4586
|
+
return clampEntity("unit", maxUnit, 0, 6, 1, durationFieldNamesAsc), ((doSubtract, slots, otherSlots, maxUnit) => createDurationSlots(validateDurationFields(((a, b, largestUnit, doSubtract) => {
|
|
4696
4587
|
const combined = durationDayTimeToBigNano(a) + durationDayTimeToBigNano(b) * BigInt(doSubtract ? -1 : 1);
|
|
4697
4588
|
return Number.isFinite(Number(combined / bigNanoInUtcDay)) || throwRangeError(outOfBoundsDate),
|
|
4698
4589
|
{
|
|
@@ -4704,7 +4595,19 @@ function addDurationsWithoutRelativeTo(doSubtract, slots, otherSlots) {
|
|
|
4704
4595
|
|
|
4705
4596
|
function roundDuration(refineRelativeTo, slots, options) {
|
|
4706
4597
|
const durationLargestUnit = getMaxDurationUnit(slots);
|
|
4707
|
-
const [largestUnit, smallestUnit, roundingInc, roundingMode, relativeToSlots] =
|
|
4598
|
+
const [largestUnit, smallestUnit, roundingInc, roundingMode, relativeToSlots] = ((options, defaultLargestUnit, refineRelativeTo) => {
|
|
4599
|
+
options = normalizeOptionsOrString(options, smallestUnitStr);
|
|
4600
|
+
let largestUnit = coerceLargestUnit(options);
|
|
4601
|
+
const relativeToInternals = refineRelativeTo(options.relativeTo);
|
|
4602
|
+
let roundingInc = coerceRoundingIncInteger(options);
|
|
4603
|
+
const roundingMode = coerceRoundingMode(options, 7);
|
|
4604
|
+
let smallestUnit = coerceSmallestUnit(options);
|
|
4605
|
+
return void 0 === largestUnit && void 0 === smallestUnit && throwRangeError("Required smallestUnit or largestUnit"),
|
|
4606
|
+
null == smallestUnit && (smallestUnit = 0), null == largestUnit && (largestUnit = Math.max(smallestUnit, defaultLargestUnit)),
|
|
4607
|
+
checkLargestSmallestUnit(largestUnit, smallestUnit), roundingInc = validateRoundingInc(roundingInc, smallestUnit, 1),
|
|
4608
|
+
roundingInc > 1 && smallestUnit > 5 && largestUnit !== smallestUnit && throwRangeError("For calendar units with roundingIncrement > 1, use largestUnit = smallestUnit"),
|
|
4609
|
+
[ largestUnit, smallestUnit, roundingInc, roundingMode, relativeToInternals ];
|
|
4610
|
+
})(options, durationLargestUnit, refineRelativeTo);
|
|
4708
4611
|
if (!relativeToSlots && Math.max(durationLargestUnit, largestUnit) <= 6) {
|
|
4709
4612
|
return createDurationSlots(validateDurationFields(((durationFields, largestUnit, smallestUnit, roundingInc, roundingMode) => {
|
|
4710
4613
|
const roundedBigNano = roundBigNanoToInc(durationDayTimeToBigNano(durationFields), computeBigNanoInc(smallestUnit, roundingInc), roundingMode);
|
|
@@ -4984,6 +4887,21 @@ function readAndRefineBagFields(bag, validFieldNames, fieldRefiners, requiredFie
|
|
|
4984
4887
|
res;
|
|
4985
4888
|
}
|
|
4986
4889
|
|
|
4890
|
+
function refineOverflowOptions(options) {
|
|
4891
|
+
return void 0 === options ? 0 : coerceOverflow(requireObjectLike(options));
|
|
4892
|
+
}
|
|
4893
|
+
|
|
4894
|
+
function refineZonedFieldOptions(options, defaultOffsetDisambig = 0) {
|
|
4895
|
+
options = normalizeOptions(options);
|
|
4896
|
+
const epochDisambig = coerceEpochDisambig(options);
|
|
4897
|
+
const offsetDisambig = coerceOffsetDisambig(options, defaultOffsetDisambig);
|
|
4898
|
+
return [ coerceOverflow(options), offsetDisambig, epochDisambig ];
|
|
4899
|
+
}
|
|
4900
|
+
|
|
4901
|
+
function refineEpochDisambigOptions(options) {
|
|
4902
|
+
return coerceEpochDisambig(normalizeOptions(options));
|
|
4903
|
+
}
|
|
4904
|
+
|
|
4987
4905
|
function refineCalendarDateFields(fields, calendar, allowMissingDay) {
|
|
4988
4906
|
const eraOrigins = getCalendarEraOrigins(calendar);
|
|
4989
4907
|
void 0 !== fields.year || void 0 !== fields.era && void 0 !== fields.eraYear || throwTypeError(missingYear(eraOrigins)),
|
|
@@ -5093,8 +5011,32 @@ const timeZonePeriodDaysByName = {
|
|
|
5093
5011
|
|
|
5094
5012
|
const minPossibleTransitionSec = -388152e4;
|
|
5095
5013
|
|
|
5014
|
+
function refineTimeDisplayTuple(options, maxSmallestUnit = 4) {
|
|
5015
|
+
const subsecDigits = coerceFractionalSecondDigits(options);
|
|
5016
|
+
const roundingMode = coerceRoundingMode(options, 4);
|
|
5017
|
+
const smallestUnit = coerceSmallestUnit(options);
|
|
5018
|
+
return [ roundingMode, ...resolveSmallestUnitAndSubsecDigits(validateUnitRange(smallestUnitStr, smallestUnit, 0, maxSmallestUnit), subsecDigits) ];
|
|
5019
|
+
}
|
|
5020
|
+
|
|
5021
|
+
function refineDateDisplayOptions(options) {
|
|
5022
|
+
return coerceCalendarDisplay(normalizeOptions(options));
|
|
5023
|
+
}
|
|
5024
|
+
|
|
5025
|
+
function refineTimeDisplayOptions(options, maxSmallestUnit) {
|
|
5026
|
+
return refineTimeDisplayTuple(normalizeOptions(options), maxSmallestUnit);
|
|
5027
|
+
}
|
|
5028
|
+
|
|
5029
|
+
function resolveSmallestUnitAndSubsecDigits(smallestUnit, subsecDigits) {
|
|
5030
|
+
return null != smallestUnit ? [ unitNanoMap[smallestUnit], smallestUnit < 4 ? 9 - 3 * smallestUnit : -1 ] : [ void 0 === subsecDigits ? 1 : 10 ** (9 - subsecDigits), subsecDigits ];
|
|
5031
|
+
}
|
|
5032
|
+
|
|
5096
5033
|
function formatInstantIso(refineTimeZoneString, instantSlots, options) {
|
|
5097
|
-
const [timeZoneArg, roundingMode, nanoInc, subsecDigits] =
|
|
5034
|
+
const [timeZoneArg, roundingMode, nanoInc, subsecDigits] = (options => {
|
|
5035
|
+
const subsecDigits = coerceFractionalSecondDigits(options = normalizeOptions(options));
|
|
5036
|
+
const roundingMode = coerceRoundingMode(options, 4);
|
|
5037
|
+
const smallestUnit = coerceSmallestUnit(options);
|
|
5038
|
+
return [ options.timeZone, roundingMode, ...resolveSmallestUnitAndSubsecDigits(validateUnitRange(smallestUnitStr, smallestUnit, 0, 4), subsecDigits) ];
|
|
5039
|
+
})(options);
|
|
5098
5040
|
const providedTimeZone = void 0 !== timeZoneArg;
|
|
5099
5041
|
return ((providedTimeZone, timeZone, epochNano, roundingMode, nanoInc, subsecDigits) => {
|
|
5100
5042
|
epochNano = roundBigNanoToDayOriginInc(epochNano, BigInt(nanoInc), roundingMode);
|
|
@@ -5104,7 +5046,15 @@ function formatInstantIso(refineTimeZoneString, instantSlots, options) {
|
|
|
5104
5046
|
}
|
|
5105
5047
|
|
|
5106
5048
|
function formatZonedDateTimeIso(zonedDateTimeSlots0, options) {
|
|
5107
|
-
const displayOptions =
|
|
5049
|
+
const displayOptions = (options => {
|
|
5050
|
+
options = normalizeOptions(options);
|
|
5051
|
+
const calendarDisplay = coerceCalendarDisplay(options);
|
|
5052
|
+
const subsecDigits = coerceFractionalSecondDigits(options);
|
|
5053
|
+
const offsetDisplay = coerceOffsetDisplay(options);
|
|
5054
|
+
const roundingMode = coerceRoundingMode(options, 4);
|
|
5055
|
+
const smallestUnit = coerceSmallestUnit(options);
|
|
5056
|
+
return [ calendarDisplay, coerceTimeZoneDisplay(options), offsetDisplay, roundingMode, ...resolveSmallestUnitAndSubsecDigits(validateUnitRange(smallestUnitStr, smallestUnit, 0, 4), subsecDigits) ];
|
|
5057
|
+
})(options);
|
|
5108
5058
|
return ((calendar, timeZoneId, timeZone, epochNano, calendarDisplay, timeZoneDisplay, offsetDisplay, roundingMode, nanoInc, subsecDigits) => {
|
|
5109
5059
|
epochNano = roundBigNanoToDayOriginInc(epochNano, BigInt(nanoInc), roundingMode);
|
|
5110
5060
|
const offsetNano = timeZone.B(epochNano);
|
|
@@ -5113,7 +5063,7 @@ function formatZonedDateTimeIso(zonedDateTimeSlots0, options) {
|
|
|
5113
5063
|
}
|
|
5114
5064
|
|
|
5115
5065
|
function formatPlainDateTimeIso(plainDateTimeSlots0, options) {
|
|
5116
|
-
const displayOptions =
|
|
5066
|
+
const displayOptions = (options => (options = normalizeOptions(options), [ coerceCalendarDisplay(options), ...refineTimeDisplayTuple(options) ]))(options);
|
|
5117
5067
|
return ((calendar, isoDateTime, calendarDisplay, roundingMode, nanoInc, subsecDigits) => formatIsoDateTimeFields(roundDateTimeToInc(isoDateTime, nanoInc, roundingMode), subsecDigits) + formatCalendar(calendar, calendarDisplay))(plainDateTimeSlots0.calendar, plainDateTimeSlots0, ...displayOptions);
|
|
5118
5068
|
}
|
|
5119
5069
|
|
|
@@ -5918,7 +5868,11 @@ function computeMonthCode(calendar, year, month) {
|
|
|
5918
5868
|
}
|
|
5919
5869
|
|
|
5920
5870
|
function totalDuration(refineRelativeTo, slots, options) {
|
|
5921
|
-
const [totalUnit, relativeToSlots] =
|
|
5871
|
+
const [totalUnit, relativeToSlots] = ((options, refineRelativeTo) => {
|
|
5872
|
+
const relativeToInternals = refineRelativeTo((options = normalizeOptionsOrString(options, "unit")).relativeTo);
|
|
5873
|
+
let totalUnit = coerceTotalUnit(options);
|
|
5874
|
+
return totalUnit = requirePropDefined("unit", totalUnit), [ totalUnit, relativeToInternals ];
|
|
5875
|
+
})(options, refineRelativeTo);
|
|
5922
5876
|
const maxDurationUnit = getMaxDurationUnit(slots);
|
|
5923
5877
|
const maxUnit = Math.max(totalUnit, maxDurationUnit);
|
|
5924
5878
|
const isZoned = relativeToSlots && isZonedEpochSlots(relativeToSlots);
|
|
@@ -6146,6 +6100,12 @@ function zonedDateTimeWithPlainTime(zonedDateTimeSlots, plainTimeFields) {
|
|
|
6146
6100
|
createZonedEpochNanoSlots(epochNano, timeZone, zonedDateTimeSlots.calendar);
|
|
6147
6101
|
}
|
|
6148
6102
|
|
|
6103
|
+
function refineDirectionOptions(options) {
|
|
6104
|
+
const normalizedOptions = normalizeOptionsOrString(options, "direction");
|
|
6105
|
+
const res = coerceDirection(normalizedOptions, 0);
|
|
6106
|
+
return res || throwRangeError(invalidEntity("direction", res)), res;
|
|
6107
|
+
}
|
|
6108
|
+
|
|
6149
6109
|
function getCurrentIsoDateTime(timeZone) {
|
|
6150
6110
|
const epochNano = getCurrentEpochNano();
|
|
6151
6111
|
const offsetNano = timeZone.B(epochNano);
|
|
@@ -12564,7 +12524,7 @@ function getHolidaysOnDate(date, il) {
|
|
|
12564
12524
|
}
|
|
12565
12525
|
return events.filter(ev => ev.observedIn(il));
|
|
12566
12526
|
}
|
|
12567
|
-
const { CHAG, LIGHT_CANDLES_TZEIS: LIGHT_CANDLES_TZEIS$2, CHANUKAH_CANDLES: CHANUKAH_CANDLES$1, BEHAB: BEHAB$1, MINOR_FAST: MINOR_FAST$1, SPECIAL_SHABBAT: SPECIAL_SHABBAT$1, MAJOR_FAST: MAJOR_FAST$1, MINOR_HOLIDAY: MINOR_HOLIDAY$1, EREV: EREV$1, } = flags;
|
|
12527
|
+
const { CHAG, LIGHT_CANDLES_TZEIS: LIGHT_CANDLES_TZEIS$2, CHANUKAH_CANDLES: CHANUKAH_CANDLES$1, BEHAB: BEHAB$1, MINOR_FAST: MINOR_FAST$1, SPECIAL_SHABBAT: SPECIAL_SHABBAT$1, MAJOR_FAST: MAJOR_FAST$1, MINOR_HOLIDAY: MINOR_HOLIDAY$1, EREV: EREV$1, SHABBAT_MEVARCHIM: SHABBAT_MEVARCHIM$1, } = flags;
|
|
12568
12528
|
const SUN = 0;
|
|
12569
12529
|
const TUE = 2;
|
|
12570
12530
|
const THU = 4;
|
|
@@ -12577,18 +12537,44 @@ function addToMap(map, ...events) {
|
|
|
12577
12537
|
const key = ev.date.toString();
|
|
12578
12538
|
const arr = map.get(key);
|
|
12579
12539
|
if (arr !== undefined) {
|
|
12580
|
-
|
|
12581
|
-
arr.unshift(ev);
|
|
12582
|
-
}
|
|
12583
|
-
else {
|
|
12584
|
-
arr.push(ev);
|
|
12585
|
-
}
|
|
12540
|
+
arr.push(ev);
|
|
12586
12541
|
}
|
|
12587
12542
|
else {
|
|
12588
12543
|
map.set(key, [ev]);
|
|
12589
12544
|
}
|
|
12590
12545
|
}
|
|
12591
12546
|
}
|
|
12547
|
+
/** @internal */
|
|
12548
|
+
const TIME_OF_DAY_MORNING = 0;
|
|
12549
|
+
/** @internal */
|
|
12550
|
+
const TIME_OF_DAY_MEVARCHIM = 1;
|
|
12551
|
+
/** @internal */
|
|
12552
|
+
const TIME_OF_DAY_DAY = 2;
|
|
12553
|
+
/** @internal */
|
|
12554
|
+
const TIME_OF_DAY_EVENING = 3;
|
|
12555
|
+
/**
|
|
12556
|
+
* Approximate time of day of an event, used to order events on the same date.
|
|
12557
|
+
* - Morning: special Shabbatot (tied to the Torah or Haftarah reading), minor
|
|
12558
|
+
* fasts (which begin at dawn) and Birkat Hachamah (recited at sunrise)
|
|
12559
|
+
* - Shabbat Mevarchim, announced in synagogue after the Torah reading
|
|
12560
|
+
* - Day: everything else
|
|
12561
|
+
* - Evening: Erev holidays, Chanukah candle-lighting and Leil Selichot
|
|
12562
|
+
* @internal
|
|
12563
|
+
*/
|
|
12564
|
+
function timeOfDay(ev) {
|
|
12565
|
+
const mask = ev.getFlags();
|
|
12566
|
+
const desc = ev.getDesc();
|
|
12567
|
+
if (mask & (EREV$1 | CHANUKAH_CANDLES$1) || desc === holidayDesc.LEIL_SELICHOT) {
|
|
12568
|
+
return TIME_OF_DAY_EVENING;
|
|
12569
|
+
}
|
|
12570
|
+
if (mask & (SPECIAL_SHABBAT$1 | MINOR_FAST$1) || desc === holidayDesc.BIRKAT_HACHAMAH) {
|
|
12571
|
+
return TIME_OF_DAY_MORNING;
|
|
12572
|
+
}
|
|
12573
|
+
if (mask & SHABBAT_MEVARCHIM$1) {
|
|
12574
|
+
return TIME_OF_DAY_MEVARCHIM;
|
|
12575
|
+
}
|
|
12576
|
+
return TIME_OF_DAY_DAY;
|
|
12577
|
+
}
|
|
12592
12578
|
function addStaticHolidays(map, year) {
|
|
12593
12579
|
for (const h of staticHolidays) {
|
|
12594
12580
|
const hd = new HDate(h.dd, h.mm, year);
|
|
@@ -12757,6 +12743,9 @@ function getHolidaysForYear_(year) {
|
|
|
12757
12743
|
const hd = new HDate(birkatHaChama);
|
|
12758
12744
|
addToMap(map, new HolidayEvent(hd, holidayDesc.BIRKAT_HACHAMAH, MINOR_HOLIDAY$1, { emoji: '☀️' }));
|
|
12759
12745
|
}
|
|
12746
|
+
for (const arr of map.values()) {
|
|
12747
|
+
arr.sort((a, b) => timeOfDay(a) - timeOfDay(b));
|
|
12748
|
+
}
|
|
12760
12749
|
yearCache.set(year, map);
|
|
12761
12750
|
return map;
|
|
12762
12751
|
}
|
|
@@ -14612,9 +14601,26 @@ function calendar(options = {}) {
|
|
|
14612
14601
|
let candlesEv;
|
|
14613
14602
|
const holidays0 = holidaysYear.get(hd.toString()) || [];
|
|
14614
14603
|
const holidays = holidays0.filter(ev => ev.observedIn(il));
|
|
14604
|
+
// On Shabbat, events tied to the morning Torah reading and announcements
|
|
14605
|
+
// in synagogue come first: the parsha, special Shabbatot such as
|
|
14606
|
+
// Shabbat Shekalim, then the Molad and Shabbat Mevarchim
|
|
14607
|
+
if (options.sedrot && isSaturday) {
|
|
14608
|
+
const parsha0 = sedra.lookup(abs);
|
|
14609
|
+
if (!parsha0.chag) {
|
|
14610
|
+
evts.push(new ParshaEvent(parsha0));
|
|
14611
|
+
}
|
|
14612
|
+
}
|
|
14613
|
+
let mevarchim = isSaturday && (options.molad || options.shabbatMevarchim)
|
|
14614
|
+
? makeMoladAndMevarchimChodesh(hd, options)
|
|
14615
|
+
: [];
|
|
14615
14616
|
for (const ev of holidays) {
|
|
14617
|
+
if (mevarchim.length && timeOfDay(ev) > TIME_OF_DAY_MEVARCHIM) {
|
|
14618
|
+
evts.push(...mevarchim);
|
|
14619
|
+
mevarchim = [];
|
|
14620
|
+
}
|
|
14616
14621
|
candlesEv = appendHolidayAndRelated(candlesEv, evts, ev, options, isFriday, isSaturday, hasUserMask);
|
|
14617
14622
|
}
|
|
14623
|
+
evts.push(...mevarchim);
|
|
14618
14624
|
const mm = hd.getMonth();
|
|
14619
14625
|
const dd = hd.getDate();
|
|
14620
14626
|
// When Erev Pesach falls on Shabbat, burning chametz is moved to Friday.
|
|
@@ -14624,12 +14630,6 @@ function calendar(options = {}) {
|
|
|
14624
14630
|
evts.push(biurEv);
|
|
14625
14631
|
}
|
|
14626
14632
|
}
|
|
14627
|
-
if (options.sedrot && isSaturday) {
|
|
14628
|
-
const parsha0 = sedra.lookup(abs);
|
|
14629
|
-
if (!parsha0.chag) {
|
|
14630
|
-
evts.push(new ParshaEvent(parsha0));
|
|
14631
|
-
}
|
|
14632
|
-
}
|
|
14633
14633
|
if (options.yizkor) {
|
|
14634
14634
|
if ((mm === months.TISHREI && (dd === 10 || dd === 22)) ||
|
|
14635
14635
|
(mm === NISAN && dd === (il ? 21 : 22)) ||
|
|
@@ -14656,22 +14656,6 @@ function calendar(options = {}) {
|
|
|
14656
14656
|
const omerEv = makeOmerEvent(hd, omer, options);
|
|
14657
14657
|
evts.push(omerEv);
|
|
14658
14658
|
}
|
|
14659
|
-
if (isSaturday && (options.molad || options.shabbatMevarchim)) {
|
|
14660
|
-
const events = makeMoladAndMevarchimChodesh(hd, options);
|
|
14661
|
-
evts.push(...events);
|
|
14662
|
-
}
|
|
14663
|
-
if (options.kiddushLevanaMaharil && dd >= 9 && dd <= 17) {
|
|
14664
|
-
// The event usually falls between the 11th and the 16th, but may be
|
|
14665
|
-
// moved back to candle-lighting before a Shabbat or Yom Tov
|
|
14666
|
-
const monthKey = hyear * 100 + mm;
|
|
14667
|
-
if (monthKey !== kiddushLevanaMonth) {
|
|
14668
|
-
kiddushLevanaMonth = monthKey;
|
|
14669
|
-
kiddushLevanaEv = makeKiddushLevanaEvent(hyear, mm, options);
|
|
14670
|
-
}
|
|
14671
|
-
if (kiddushLevanaEv?.getDate().abs() === abs) {
|
|
14672
|
-
evts.push(kiddushLevanaEv);
|
|
14673
|
-
}
|
|
14674
|
-
}
|
|
14675
14659
|
if (!candlesEv && options.candlelighting && (isFriday || isSaturday)) {
|
|
14676
14660
|
candlesEv = makeCandleEvent(undefined, hd, options, isFriday, isSaturday);
|
|
14677
14661
|
if (isFriday && candlesEv && sedra) {
|
|
@@ -14693,6 +14677,18 @@ function calendar(options = {}) {
|
|
|
14693
14677
|
if (candlesEv) {
|
|
14694
14678
|
evts.push(candlesEv);
|
|
14695
14679
|
}
|
|
14680
|
+
if (options.kiddushLevanaMaharil && dd >= 9 && dd <= 17) {
|
|
14681
|
+
// The event usually falls between the 11th and the 16th, but may be
|
|
14682
|
+
// moved back to candle-lighting before a Shabbat or Yom Tov
|
|
14683
|
+
const monthKey = hyear * 100 + mm;
|
|
14684
|
+
if (monthKey !== kiddushLevanaMonth) {
|
|
14685
|
+
kiddushLevanaMonth = monthKey;
|
|
14686
|
+
kiddushLevanaEv = makeKiddushLevanaEvent(hyear, mm, options);
|
|
14687
|
+
}
|
|
14688
|
+
if (kiddushLevanaEv?.getDate().abs() === abs) {
|
|
14689
|
+
insertTimedEvent(evts, prevEventsLength, kiddushLevanaEv);
|
|
14690
|
+
}
|
|
14691
|
+
}
|
|
14696
14692
|
if (options.addHebrewDates ||
|
|
14697
14693
|
(options.addHebrewDatesForEvents &&
|
|
14698
14694
|
prevEventsLength !== evts.length - numDailyLearning)) {
|
|
@@ -14998,6 +14994,23 @@ function setOptionsFromMask(options) {
|
|
|
14998
14994
|
options.kiddushLevanaMaharil = true;
|
|
14999
14995
|
return m;
|
|
15000
14996
|
}
|
|
14997
|
+
/**
|
|
14998
|
+
* Inserts `ev` into today's events (those at index `start` and beyond)
|
|
14999
|
+
* just before the first `TimedEvent` that occurs later, or appends it.
|
|
15000
|
+
* Unlike other timed events, Latest Kiddush Levana may fall at dawn,
|
|
15001
|
+
* at candle-lighting or late at night, so its position can't be fixed.
|
|
15002
|
+
*/
|
|
15003
|
+
function insertTimedEvent(events, start, ev) {
|
|
15004
|
+
const time = ev.eventTime.getTime();
|
|
15005
|
+
for (let i = start; i < events.length; i++) {
|
|
15006
|
+
const other = events[i];
|
|
15007
|
+
if (other instanceof TimedEvent && other.eventTime.getTime() > time) {
|
|
15008
|
+
events.splice(i, 0, ev);
|
|
15009
|
+
return;
|
|
15010
|
+
}
|
|
15011
|
+
}
|
|
15012
|
+
events.push(ev);
|
|
15013
|
+
}
|
|
15001
15014
|
/**
|
|
15002
15015
|
* Appends the Event `ev` to the `events` array. Also may add related
|
|
15003
15016
|
* timed events like candle-lighting or fast start/end
|