rrule-temporal 2.1.0 → 2.2.1
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 +54 -39
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +79 -32
- package/dist/index.d.ts +79 -32
- package/dist/index.js +1 -1
- package/dist/{src-b3FbAWaY.js → src-CGqBFmHR.js} +375 -186
- package/dist/{src-BL9G7GR8.cjs → src-CxM15CdD.cjs} +375 -186
- package/dist/totext.cjs +1 -1
- package/dist/totext.js +1 -1
- package/package.json +1 -1
|
@@ -4678,7 +4678,8 @@ function normalizeZonedDateTime(value, label) {
|
|
|
4678
4678
|
}
|
|
4679
4679
|
}
|
|
4680
4680
|
function normalizeZonedDateTimeList(values, label) {
|
|
4681
|
-
|
|
4681
|
+
if (!values?.length) return void 0;
|
|
4682
|
+
return values.map((value) => normalizeZonedDateTime(value, label));
|
|
4682
4683
|
}
|
|
4683
4684
|
function isIcsOpts(opts) {
|
|
4684
4685
|
return typeof opts.rruleString === "string";
|
|
@@ -4951,16 +4952,22 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
4951
4952
|
static normalizeToPolyfill(zdt) {
|
|
4952
4953
|
return normalizeZonedDateTime(zdt, "Date");
|
|
4953
4954
|
}
|
|
4954
|
-
|
|
4955
|
-
return
|
|
4955
|
+
toInternalIterator(iterator) {
|
|
4956
|
+
if (!iterator) return void 0;
|
|
4957
|
+
return (date, i) => iterator(this.toPublicDate(date), i);
|
|
4956
4958
|
}
|
|
4957
|
-
|
|
4958
|
-
return
|
|
4959
|
+
toPublicDate(date) {
|
|
4960
|
+
if (!date) return null;
|
|
4961
|
+
const outputConstructor = this.outputTemporal?.ZonedDateTime;
|
|
4962
|
+
if (!outputConstructor || outputConstructor === Temporal.ZonedDateTime) return date;
|
|
4963
|
+
return outputConstructor.from(date.toString());
|
|
4959
4964
|
}
|
|
4960
|
-
|
|
4961
|
-
return dates;
|
|
4965
|
+
toPublicDates(dates) {
|
|
4966
|
+
if (!this.outputTemporal || this.outputTemporal.ZonedDateTime === Temporal.ZonedDateTime) return dates;
|
|
4967
|
+
return dates.map((date) => this.outputTemporal.ZonedDateTime.from(date.toString()));
|
|
4962
4968
|
}
|
|
4963
4969
|
constructor(params) {
|
|
4970
|
+
this.outputTemporal = params.temporal;
|
|
4964
4971
|
let manual;
|
|
4965
4972
|
if (isIcsOpts(params)) {
|
|
4966
4973
|
const parsed = parseRRuleString(params.rruleString, params.tzid, params.dtstart, params.strict ?? false);
|
|
@@ -4977,8 +4984,10 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
4977
4984
|
until: params.until ? RRuleTemporal.normalizeToPolyfill(params.until) : parsed.until,
|
|
4978
4985
|
strict: params.strict,
|
|
4979
4986
|
maxIterations: params.maxIterations,
|
|
4987
|
+
maxCandidateEvaluations: params.maxCandidateEvaluations,
|
|
4980
4988
|
includeDtstart: params.includeDtstart,
|
|
4981
4989
|
cache: params.cache,
|
|
4990
|
+
temporal: params.temporal,
|
|
4982
4991
|
tzid: this.tzid
|
|
4983
4992
|
};
|
|
4984
4993
|
} else {
|
|
@@ -4999,6 +5008,8 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
4999
5008
|
if (manual.interval <= 0) throw new Error("Cannot create RRule: interval must be greater than 0");
|
|
5000
5009
|
this.opts = this.sanitizeOpts(manual);
|
|
5001
5010
|
this.maxIterations = manual.maxIterations ?? 1e4;
|
|
5011
|
+
this.maxCandidateEvaluations = manual.maxCandidateEvaluations ?? 1e6;
|
|
5012
|
+
if (!Number.isSafeInteger(this.maxCandidateEvaluations) || this.maxCandidateEvaluations <= 0) throw new Error("maxCandidateEvaluations must be a positive safe integer");
|
|
5002
5013
|
this.includeDtstart = manual.includeDtstart ?? false;
|
|
5003
5014
|
this.parsedByDayTokens = this.buildParsedByDayTokens(this.opts.byDay);
|
|
5004
5015
|
this.simpleByDayIsoDays = this.buildByDayIsoDays(this.parsedByDayTokens, false);
|
|
@@ -5030,25 +5041,35 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
5030
5041
|
}
|
|
5031
5042
|
sanitizeNumericArray(arr, min, max, allowZero = false, sort = false) {
|
|
5032
5043
|
if (!arr) return void 0;
|
|
5033
|
-
const sanitized =
|
|
5044
|
+
const sanitized = [];
|
|
5045
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5046
|
+
for (const value of arr) if (Number.isInteger(value) && value >= min && value <= max && (allowZero || value !== 0) && !seen.has(value)) {
|
|
5047
|
+
seen.add(value);
|
|
5048
|
+
sanitized.push(value);
|
|
5049
|
+
}
|
|
5034
5050
|
if (sanitized.length === 0) return void 0;
|
|
5035
5051
|
return sort ? sanitized.sort((a, b) => a - b) : sanitized;
|
|
5036
5052
|
}
|
|
5037
5053
|
sanitizeByDay(byDay) {
|
|
5038
|
-
const days = (byDay ?? []).filter((day) => Boolean(day) && typeof day === "string");
|
|
5039
5054
|
const normalized = [];
|
|
5040
|
-
|
|
5055
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5056
|
+
for (const day of byDay ?? []) {
|
|
5057
|
+
if (!day || typeof day !== "string") continue;
|
|
5041
5058
|
const token = day.toUpperCase();
|
|
5042
5059
|
const parsed = parseByDayToken(token);
|
|
5043
5060
|
if (!parsed) throw new Error(`Invalid BYDAY value: ${day}`);
|
|
5044
5061
|
if (parsed.ord === 0 && /^[+-]?\d/.test(token)) throw new Error(`Invalid BYDAY value: ${day}`);
|
|
5045
|
-
|
|
5062
|
+
if (!seen.has(token)) {
|
|
5063
|
+
seen.add(token);
|
|
5064
|
+
normalized.push(token);
|
|
5065
|
+
}
|
|
5046
5066
|
}
|
|
5047
5067
|
return normalized.length > 0 ? normalized : void 0;
|
|
5048
5068
|
}
|
|
5049
5069
|
enforceStrictRfc(opts) {
|
|
5050
5070
|
if (!opts.strict) return;
|
|
5051
5071
|
const freq = opts.freq;
|
|
5072
|
+
if (opts.count !== void 0 && opts.until !== void 0) throw new Error("COUNT and UNTIL MUST NOT occur in the same recurrence rule");
|
|
5052
5073
|
if (opts.byWeekNo && freq !== "YEARLY") throw new Error("BYWEEKNO MUST NOT be used unless FREQ=YEARLY");
|
|
5053
5074
|
if (opts.byYearDay && [
|
|
5054
5075
|
"DAILY",
|
|
@@ -5072,8 +5093,9 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
5072
5093
|
}
|
|
5073
5094
|
if (opts.byMonth) {
|
|
5074
5095
|
const numeric = opts.byMonth.filter((v) => typeof v === "number");
|
|
5075
|
-
const stringy = opts.byMonth.filter((v) => typeof v === "string");
|
|
5076
|
-
const
|
|
5096
|
+
const stringy = opts.byMonth.filter((v) => typeof v === "string").map((value) => value.toUpperCase());
|
|
5097
|
+
const sanitizedNum = this.sanitizeNumericArray(numeric, 1, 12, false, false) ?? [];
|
|
5098
|
+
const merged = [...new Set([...sanitizedNum, ...stringy])];
|
|
5077
5099
|
opts.byMonth = merged.length > 0 ? merged : void 0;
|
|
5078
5100
|
}
|
|
5079
5101
|
if (opts.rscale && !opts.skip) opts.skip = "OMIT";
|
|
@@ -5136,6 +5158,169 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
5136
5158
|
}));
|
|
5137
5159
|
return out.sort((a, b) => Temporal.ZonedDateTime.compare(a, b));
|
|
5138
5160
|
}
|
|
5161
|
+
localDateKey(date) {
|
|
5162
|
+
return `${date.calendarId}:${date.year}:${date.month}:${date.day}`;
|
|
5163
|
+
}
|
|
5164
|
+
sortedUniqueDateCandidates(candidates) {
|
|
5165
|
+
const byLocalDate = /* @__PURE__ */ new Map();
|
|
5166
|
+
for (const candidate of candidates) {
|
|
5167
|
+
const key = this.localDateKey(candidate);
|
|
5168
|
+
if (!byLocalDate.has(key)) byLocalDate.set(key, candidate);
|
|
5169
|
+
}
|
|
5170
|
+
return [...byLocalDate.values()].sort((a, b) => Temporal.ZonedDateTime.compare(a, b));
|
|
5171
|
+
}
|
|
5172
|
+
timeOfDayNanoseconds(date) {
|
|
5173
|
+
return ((date.hour * 60 * 60 + date.minute * 60 + date.second) * 1e3 + date.millisecond) * 1e6 + date.microsecond * 1e3 + date.nanosecond;
|
|
5174
|
+
}
|
|
5175
|
+
timeSlotNanoseconds(base, hour, minute, second) {
|
|
5176
|
+
return ((hour * 60 * 60 + minute * 60 + second) * 1e3 + base.millisecond) * 1e6 + base.microsecond * 1e3 + base.nanosecond;
|
|
5177
|
+
}
|
|
5178
|
+
/**
|
|
5179
|
+
* `ZonedDateTime.with()` can reorder or alias wall-clock slots on a day with
|
|
5180
|
+
* an offset transition (notably when a spring-forward gap is resolved). On
|
|
5181
|
+
* those uncommon dates we retain the legacy sort semantics with a bounded
|
|
5182
|
+
* one-day fallback instead of ever materializing a whole recurrence period.
|
|
5183
|
+
*/
|
|
5184
|
+
needsSortedTimeFallback(base) {
|
|
5185
|
+
try {
|
|
5186
|
+
const startOfDay = base.startOfDay();
|
|
5187
|
+
return startOfDay.add({ days: 1 }).startOfDay().epochNanoseconds - startOfDay.epochNanoseconds !== BigInt(864e11);
|
|
5188
|
+
} catch {
|
|
5189
|
+
return true;
|
|
5190
|
+
}
|
|
5191
|
+
}
|
|
5192
|
+
createCandidateWorkBudget() {
|
|
5193
|
+
return {
|
|
5194
|
+
evaluated: 0,
|
|
5195
|
+
seenOccurrences: /* @__PURE__ */ new Set()
|
|
5196
|
+
};
|
|
5197
|
+
}
|
|
5198
|
+
recordCandidateEvaluation(work) {
|
|
5199
|
+
work.evaluated += 1;
|
|
5200
|
+
if (work.evaluated > this.maxCandidateEvaluations) throw new Error(`Maximum candidate evaluations (${this.maxCandidateEvaluations}) exceeded in all()`);
|
|
5201
|
+
}
|
|
5202
|
+
/**
|
|
5203
|
+
* Visit BYHOUR x BYMINUTE x BYSECOND without allocating the Cartesian
|
|
5204
|
+
* product. Returning false from `visit` terminates the innermost traversal
|
|
5205
|
+
* immediately. The optional bounds are only supplied for the same local
|
|
5206
|
+
* calendar date by `visitDateTimeCandidates`.
|
|
5207
|
+
*/
|
|
5208
|
+
visitTimeSlots(base, direction, visit, notBefore, notAfter, work = this.createCandidateWorkBudget()) {
|
|
5209
|
+
const hours = this.opts.byHour ?? [base.hour];
|
|
5210
|
+
const minutes = this.opts.byMinute ?? [base.minute];
|
|
5211
|
+
const seconds = this.opts.bySecond ?? [base.second];
|
|
5212
|
+
if (this.needsSortedTimeFallback(base)) {
|
|
5213
|
+
const candidates = [];
|
|
5214
|
+
for (const hour of hours) for (const minute of minutes) for (const second of seconds) {
|
|
5215
|
+
this.recordCandidateEvaluation(work);
|
|
5216
|
+
const candidate = hour === base.hour && minute === base.minute && second === base.second ? base : base.with({
|
|
5217
|
+
hour,
|
|
5218
|
+
minute,
|
|
5219
|
+
second
|
|
5220
|
+
});
|
|
5221
|
+
if (notBefore && Temporal.ZonedDateTime.compare(candidate, notBefore) < 0) continue;
|
|
5222
|
+
if (notAfter && Temporal.ZonedDateTime.compare(candidate, notAfter) > 0) continue;
|
|
5223
|
+
candidates.push(candidate);
|
|
5224
|
+
}
|
|
5225
|
+
candidates.sort((a, b) => Temporal.ZonedDateTime.compare(a, b));
|
|
5226
|
+
let previousEpoch;
|
|
5227
|
+
const start = direction === 1 ? 0 : candidates.length - 1;
|
|
5228
|
+
const end = direction === 1 ? candidates.length : -1;
|
|
5229
|
+
for (let index = start; index !== end; index += direction) {
|
|
5230
|
+
const candidate = candidates[index];
|
|
5231
|
+
if (candidate.epochNanoseconds === previousEpoch) continue;
|
|
5232
|
+
previousEpoch = candidate.epochNanoseconds;
|
|
5233
|
+
if (!visit(candidate)) return false;
|
|
5234
|
+
}
|
|
5235
|
+
return true;
|
|
5236
|
+
}
|
|
5237
|
+
const lowerTime = notBefore ? this.timeOfDayNanoseconds(notBefore) : void 0;
|
|
5238
|
+
const upperTime = notAfter ? this.timeOfDayNanoseconds(notAfter) : void 0;
|
|
5239
|
+
const hourStart = direction === 1 ? 0 : hours.length - 1;
|
|
5240
|
+
const hourEnd = direction === 1 ? hours.length : -1;
|
|
5241
|
+
for (let hourIndex = hourStart; hourIndex !== hourEnd; hourIndex += direction) {
|
|
5242
|
+
const hour = hours[hourIndex];
|
|
5243
|
+
const minuteStart = direction === 1 ? 0 : minutes.length - 1;
|
|
5244
|
+
const minuteEnd = direction === 1 ? minutes.length : -1;
|
|
5245
|
+
for (let minuteIndex = minuteStart; minuteIndex !== minuteEnd; minuteIndex += direction) {
|
|
5246
|
+
const minute = minutes[minuteIndex];
|
|
5247
|
+
const secondStart = direction === 1 ? 0 : seconds.length - 1;
|
|
5248
|
+
const secondEnd = direction === 1 ? seconds.length : -1;
|
|
5249
|
+
for (let secondIndex = secondStart; secondIndex !== secondEnd; secondIndex += direction) {
|
|
5250
|
+
const second = seconds[secondIndex];
|
|
5251
|
+
const slotTime = this.timeSlotNanoseconds(base, hour, minute, second);
|
|
5252
|
+
if (lowerTime !== void 0 && slotTime < lowerTime) continue;
|
|
5253
|
+
if (upperTime !== void 0 && slotTime > upperTime) continue;
|
|
5254
|
+
this.recordCandidateEvaluation(work);
|
|
5255
|
+
if (!visit(hour === base.hour && minute === base.minute && second === base.second ? base : base.with({
|
|
5256
|
+
hour,
|
|
5257
|
+
minute,
|
|
5258
|
+
second
|
|
5259
|
+
}))) return false;
|
|
5260
|
+
}
|
|
5261
|
+
}
|
|
5262
|
+
}
|
|
5263
|
+
return true;
|
|
5264
|
+
}
|
|
5265
|
+
visitDateTimeCandidates(dateCandidates, direction, visit, notBefore, notAfter, work = this.createCandidateWorkBudget()) {
|
|
5266
|
+
const dates = this.sortedUniqueDateCandidates(dateCandidates);
|
|
5267
|
+
const localNotBefore = notBefore?.withTimeZone(this.tzid);
|
|
5268
|
+
const localNotAfter = notAfter?.withTimeZone(this.tzid);
|
|
5269
|
+
const notBeforeDate = localNotBefore?.toPlainDate();
|
|
5270
|
+
const notAfterDate = localNotAfter?.toPlainDate();
|
|
5271
|
+
const start = direction === 1 ? 0 : dates.length - 1;
|
|
5272
|
+
const end = direction === 1 ? dates.length : -1;
|
|
5273
|
+
let previousEpoch;
|
|
5274
|
+
for (let index = start; index !== end; index += direction) {
|
|
5275
|
+
const date = dates[index];
|
|
5276
|
+
const plainDate = date.toPlainDate();
|
|
5277
|
+
if (notBeforeDate && Temporal.PlainDate.compare(plainDate, notBeforeDate) < 0) continue;
|
|
5278
|
+
if (notAfterDate && Temporal.PlainDate.compare(plainDate, notAfterDate) > 0) continue;
|
|
5279
|
+
const sameAsLowerDate = notBeforeDate && Temporal.PlainDate.compare(plainDate, notBeforeDate) === 0;
|
|
5280
|
+
const sameAsUpperDate = notAfterDate && Temporal.PlainDate.compare(plainDate, notAfterDate) === 0;
|
|
5281
|
+
if (!this.visitTimeSlots(date, direction, (candidate) => {
|
|
5282
|
+
if (candidate.epochNanoseconds === previousEpoch) return true;
|
|
5283
|
+
previousEpoch = candidate.epochNanoseconds;
|
|
5284
|
+
return visit(candidate);
|
|
5285
|
+
}, sameAsLowerDate ? localNotBefore : void 0, sameAsUpperDate ? localNotAfter : void 0, work)) return false;
|
|
5286
|
+
}
|
|
5287
|
+
return true;
|
|
5288
|
+
}
|
|
5289
|
+
/** Apply BYSETPOS with bounded forward/reverse passes over one period. */
|
|
5290
|
+
visitPeriodCandidates(dateCandidates, visit, notBefore, notAfter, work = this.createCandidateWorkBudget()) {
|
|
5291
|
+
const positions = this.opts.bySetPos;
|
|
5292
|
+
if (!positions?.length) return this.visitDateTimeCandidates(dateCandidates, 1, visit, notBefore, notAfter, work);
|
|
5293
|
+
const positive = new Set(positions.filter((position) => position > 0));
|
|
5294
|
+
const negative = new Set(positions.filter((position) => position < 0).map((position) => -position));
|
|
5295
|
+
const selected = /* @__PURE__ */ new Map();
|
|
5296
|
+
if (positive.size > 0) {
|
|
5297
|
+
let lastPositive = 0;
|
|
5298
|
+
for (const position of positive) lastPositive = Math.max(lastPositive, position);
|
|
5299
|
+
let rank = 0;
|
|
5300
|
+
this.visitDateTimeCandidates(dateCandidates, 1, (candidate) => {
|
|
5301
|
+
rank += 1;
|
|
5302
|
+
if (positive.has(rank)) selected.set(candidate.epochNanoseconds, candidate);
|
|
5303
|
+
return rank < lastPositive;
|
|
5304
|
+
}, void 0, void 0, work);
|
|
5305
|
+
}
|
|
5306
|
+
if (negative.size > 0) {
|
|
5307
|
+
let lastNegative = 0;
|
|
5308
|
+
for (const position of negative) lastNegative = Math.max(lastNegative, position);
|
|
5309
|
+
let rank = 0;
|
|
5310
|
+
this.visitDateTimeCandidates(dateCandidates, -1, (candidate) => {
|
|
5311
|
+
rank += 1;
|
|
5312
|
+
if (negative.has(rank)) selected.set(candidate.epochNanoseconds, candidate);
|
|
5313
|
+
return rank < lastNegative;
|
|
5314
|
+
}, void 0, void 0, work);
|
|
5315
|
+
}
|
|
5316
|
+
const sorted = [...selected.values()].sort((a, b) => Temporal.ZonedDateTime.compare(a, b));
|
|
5317
|
+
for (const candidate of sorted) {
|
|
5318
|
+
if (notBefore && Temporal.ZonedDateTime.compare(candidate, notBefore) < 0) continue;
|
|
5319
|
+
if (notAfter && Temporal.ZonedDateTime.compare(candidate, notAfter) > 0) continue;
|
|
5320
|
+
if (!visit(candidate)) return false;
|
|
5321
|
+
}
|
|
5322
|
+
return true;
|
|
5323
|
+
}
|
|
5139
5324
|
nextCandidateSameDate(zdt) {
|
|
5140
5325
|
const { freq, interval = 1, byHour, byMinute, bySecond } = this.opts;
|
|
5141
5326
|
if (freq === "HOURLY" && byHour && byHour.length === 1) return this.applyTimeOverride(zdt.add({ days: interval }));
|
|
@@ -5479,8 +5664,44 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
5479
5664
|
else return week === lastWeek + wn + 1;
|
|
5480
5665
|
});
|
|
5481
5666
|
}
|
|
5667
|
+
/**
|
|
5668
|
+
* Gregorian weekday and leap-year patterns repeat every 400 years. Checking
|
|
5669
|
+
* a complete cycle lets impossible BYYEARDAY + BYWEEKNO intersections stop
|
|
5670
|
+
* without incorrectly judging the rule from DTSTART's year alone.
|
|
5671
|
+
*/
|
|
5672
|
+
hasPossibleYearDayWeekNoCombination() {
|
|
5673
|
+
if (!this.opts.byYearDay || !this.opts.byWeekNo) return true;
|
|
5674
|
+
let yearStart = this.originalDtstart.with({
|
|
5675
|
+
year: 2e3,
|
|
5676
|
+
month: 1,
|
|
5677
|
+
day: 1,
|
|
5678
|
+
hour: 0,
|
|
5679
|
+
minute: 0,
|
|
5680
|
+
second: 0,
|
|
5681
|
+
millisecond: 0,
|
|
5682
|
+
microsecond: 0,
|
|
5683
|
+
nanosecond: 0
|
|
5684
|
+
});
|
|
5685
|
+
for (let offset = 0; offset < 400; offset++) {
|
|
5686
|
+
const daysInYear = yearStart.daysInYear;
|
|
5687
|
+
for (const yearDay of this.opts.byYearDay) {
|
|
5688
|
+
const resolvedDay = yearDay > 0 ? yearDay : daysInYear + yearDay + 1;
|
|
5689
|
+
if (resolvedDay >= 1 && resolvedDay <= daysInYear && this.matchesByWeekNo(yearStart.add({ days: resolvedDay - 1 }))) return true;
|
|
5690
|
+
}
|
|
5691
|
+
yearStart = yearStart.add({ years: 1 });
|
|
5692
|
+
}
|
|
5693
|
+
return false;
|
|
5694
|
+
}
|
|
5482
5695
|
options() {
|
|
5483
|
-
|
|
5696
|
+
const { dtstart, until, rDate, exDate, temporal: _temporal, ...rest } = this.cloneOptions();
|
|
5697
|
+
return {
|
|
5698
|
+
...rest,
|
|
5699
|
+
...this.outputTemporal ? { temporal: this.outputTemporal } : {},
|
|
5700
|
+
dtstart: this.toPublicDate(dtstart),
|
|
5701
|
+
until: until ? this.toPublicDate(until) : void 0,
|
|
5702
|
+
rDate: rDate ? this.toPublicDates(rDate) : void 0,
|
|
5703
|
+
exDate: exDate ? this.toPublicDates(exDate) : void 0
|
|
5704
|
+
};
|
|
5484
5705
|
}
|
|
5485
5706
|
cloneOptions() {
|
|
5486
5707
|
const { byHour, byMinute, bySecond, byDay, byMonth, byMonthDay, byYearDay, byWeekNo, bySetPos, rDate, exDate, ...rest } = this.opts;
|
|
@@ -5555,7 +5776,7 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
5555
5776
|
return !iterator && this.tzid === "UTC" && this.opts.freq === "WEEKLY" && !this.opts.rscale && !this.opts.rDate && !this.opts.exDate && !this.opts.byMonth && !this.opts.byMonthDay && !this.opts.byYearDay && !this.opts.byWeekNo && !this.opts.bySetPos && (!this.opts.byHour || this.canUseEpochMillisecondsPrecisionFlag) && (!this.opts.byMinute || this.canUseEpochMillisecondsPrecisionFlag) && (!this.opts.bySecond || this.canUseEpochMillisecondsPrecisionFlag) && !this.hasOrdinalByDay;
|
|
5556
5777
|
}
|
|
5557
5778
|
canUseUtcMonthlyFastPath(iterator) {
|
|
5558
|
-
return !iterator && this.tzid === "UTC" && this.opts.freq === "MONTHLY" && !this.opts.rscale && !this.opts.rDate && !this.opts.exDate && !this.opts.byYearDay && !this.opts.byWeekNo && this.canUseEpochMillisecondsPrecisionFlag && !!(this.opts.byDay || this.opts.byMonthDay);
|
|
5779
|
+
return !iterator && this.tzid === "UTC" && this.opts.freq === "MONTHLY" && !this.opts.rscale && !this.opts.rDate && !this.opts.exDate && !this.opts.byYearDay && !this.opts.byWeekNo && this.canUseEpochMillisecondsPrecisionFlag && this.hasSingleExpandedTimeSlot() && !!(this.opts.byDay || this.opts.byMonthDay);
|
|
5559
5780
|
}
|
|
5560
5781
|
utcZdtFromEpochNanoseconds(epochNanoseconds) {
|
|
5561
5782
|
return new Temporal.ZonedDateTime(epochNanoseconds, "UTC");
|
|
@@ -6171,15 +6392,6 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
6171
6392
|
}
|
|
6172
6393
|
return finalDays;
|
|
6173
6394
|
}
|
|
6174
|
-
generateMonthlyOccurrencesOptimizedBySetPos(sample) {
|
|
6175
|
-
if (!this.opts.bySetPos || !this.hasSingleExpandedTimeSlot()) return null;
|
|
6176
|
-
const monthStart = sample.day === 1 ? sample : sample.with({ day: 1 });
|
|
6177
|
-
const days = this.generateMonthlyOccurrenceDays(monthStart);
|
|
6178
|
-
if (days.length === 0) return [];
|
|
6179
|
-
const selectedDays = this.applyBySetPosToSortedList(days);
|
|
6180
|
-
if (selectedDays.length === 0) return [];
|
|
6181
|
-
return selectedDays.sort((a, b) => a - b).map((day) => this.buildMonthlyOccurrenceOnDay(monthStart, day));
|
|
6182
|
-
}
|
|
6183
6395
|
isGregorianLeapYear(year) {
|
|
6184
6396
|
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
6185
6397
|
}
|
|
@@ -6354,7 +6566,7 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
6354
6566
|
}
|
|
6355
6567
|
break;
|
|
6356
6568
|
}
|
|
6357
|
-
if (this.opts.freq === "MONTHLY" && !this.opts.byYearDay && !this.opts.byWeekNo && !!(this.opts.byDay || this.opts.byMonthDay)) return this._allTzMonthlyByDayOrMonthDay();
|
|
6569
|
+
if (this.opts.freq === "MONTHLY" && !this.opts.byYearDay && !this.opts.byWeekNo && this.hasSingleExpandedTimeSlot() && !!(this.opts.byDay || this.opts.byMonthDay)) return this._allTzMonthlyByDayOrMonthDay();
|
|
6358
6570
|
if (this.opts.freq === "WEEKLY" && linearEligible && !this.hasOrdinalByDay && this.hasUniqueTimeSlotOffsets) return this.opts.byHour || this.opts.byMinute || this.opts.bySecond ? this._allTzWeeklyExpanded() : this._allTzWeeklySimple();
|
|
6359
6571
|
return null;
|
|
6360
6572
|
}
|
|
@@ -6541,53 +6753,54 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
6541
6753
|
}
|
|
6542
6754
|
}
|
|
6543
6755
|
processOccurrences(occs, dates, start, iterator, extraFilters) {
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
if (
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
}
|
|
6562
|
-
}
|
|
6563
|
-
return { shouldBreak };
|
|
6756
|
+
for (const occ of occs) if (!this.processOccurrence(occ, dates, start, iterator, extraFilters)) return { shouldBreak: true };
|
|
6757
|
+
return { shouldBreak: false };
|
|
6758
|
+
}
|
|
6759
|
+
/** Process one occurrence and report whether generation should continue. */
|
|
6760
|
+
processOccurrence(occurrence, dates, start, iterator, extraFilters, work) {
|
|
6761
|
+
if (work) {
|
|
6762
|
+
if (work.seenOccurrences.size === 0 && dates.length > 0) for (const date of dates) work.seenOccurrences.add(date.epochNanoseconds);
|
|
6763
|
+
if (work.seenOccurrences.has(occurrence.epochNanoseconds)) return true;
|
|
6764
|
+
work.seenOccurrences.add(occurrence.epochNanoseconds);
|
|
6765
|
+
}
|
|
6766
|
+
if (Temporal.ZonedDateTime.compare(occurrence, start) < 0) return true;
|
|
6767
|
+
if (this.opts.until && Temporal.ZonedDateTime.compare(occurrence, this.opts.until) > 0) return false;
|
|
6768
|
+
if (extraFilters && !extraFilters(occurrence)) return true;
|
|
6769
|
+
if (iterator && this.isExcluded(occurrence)) return true;
|
|
6770
|
+
if (iterator && !iterator(occurrence, dates.length)) return false;
|
|
6771
|
+
dates.push(occurrence);
|
|
6772
|
+
return !this.shouldBreakForCountLimit(dates.length);
|
|
6564
6773
|
}
|
|
6565
6774
|
/**
|
|
6566
6775
|
* Returns all occurrences of the rule.
|
|
6567
6776
|
* @param iterator - An optional callback iterator function that can be used to filter or modify the occurrences.
|
|
6568
6777
|
* @returns An array of Temporal.ZonedDateTime objects representing all occurrences of the rule.
|
|
6569
6778
|
*/
|
|
6570
|
-
_allMonthlyByDayOrMonthDay(iterator) {
|
|
6779
|
+
_allMonthlyByDayOrMonthDay(iterator, queryLowerBound) {
|
|
6571
6780
|
const dates = [];
|
|
6781
|
+
const work = this.createCandidateWorkBudget();
|
|
6572
6782
|
let iterationCount = 0;
|
|
6573
6783
|
const start = this.originalDtstart;
|
|
6574
6784
|
if (!this.addDtstartIfNeeded(dates, iterator)) return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
6575
6785
|
let monthCursor = start.with({ day: 1 });
|
|
6576
6786
|
while (true) {
|
|
6577
6787
|
if (++iterationCount > this.maxIterations) throw new Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6788
|
+
if (!this.visitPeriodCandidates(this.generateMonthlyDateCandidates(monthCursor), (candidate) => this.processOccurrence(candidate, dates, start, iterator, void 0, work), queryLowerBound ?? start, this.opts.until, work)) break;
|
|
6789
|
+
try {
|
|
6790
|
+
monthCursor = monthCursor.add({ months: this.opts.interval });
|
|
6791
|
+
} catch {
|
|
6792
|
+
break;
|
|
6793
|
+
}
|
|
6794
|
+
if (this.opts.until) {
|
|
6795
|
+
const localUntil = this.opts.until.withTimeZone(this.tzid);
|
|
6796
|
+
if (monthCursor.year * 12 + monthCursor.month > localUntil.year * 12 + localUntil.month) break;
|
|
6582
6797
|
}
|
|
6583
|
-
const { shouldBreak } = this.processOccurrences(occs, dates, start, iterator);
|
|
6584
|
-
if (shouldBreak) break;
|
|
6585
|
-
monthCursor = monthCursor.add({ months: this.opts.interval });
|
|
6586
6798
|
}
|
|
6587
6799
|
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
6588
6800
|
}
|
|
6589
|
-
_allWeekly(iterator) {
|
|
6801
|
+
_allWeekly(iterator, queryLowerBound) {
|
|
6590
6802
|
const dates = [];
|
|
6803
|
+
const work = this.createCandidateWorkBudget();
|
|
6591
6804
|
let iterationCount = 0;
|
|
6592
6805
|
const start = this.originalDtstart;
|
|
6593
6806
|
if (!this.addDtstartIfNeeded(dates, iterator)) return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
@@ -6602,15 +6815,20 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
6602
6815
|
let weekCursor = firstOccurrence.subtract({ days: firstOccWeekOffset });
|
|
6603
6816
|
while (true) {
|
|
6604
6817
|
if (++iterationCount > this.maxIterations) throw new Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);
|
|
6605
|
-
|
|
6818
|
+
const dateCandidates = dows.map((dw) => {
|
|
6606
6819
|
const delta = (dw - wkstDay + 7) % 7;
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6820
|
+
return weekCursor.add({ days: delta });
|
|
6821
|
+
});
|
|
6822
|
+
if (!this.visitPeriodCandidates(dateCandidates, (candidate) => this.processOccurrence(candidate, dates, start, iterator, (occurrence) => this.matchesByMonth(occurrence) && this.matchesByMonthDay(occurrence), work), queryLowerBound ?? start, this.opts.until, work)) break;
|
|
6823
|
+
try {
|
|
6824
|
+
weekCursor = weekCursor.add({ weeks: this.opts.interval });
|
|
6825
|
+
} catch {
|
|
6826
|
+
break;
|
|
6827
|
+
}
|
|
6828
|
+
if (this.opts.until) {
|
|
6829
|
+
const localUntil = this.opts.until.withTimeZone(this.tzid);
|
|
6830
|
+
if (Temporal.PlainDate.compare(weekCursor.toPlainDate(), localUntil.toPlainDate()) > 0) break;
|
|
6831
|
+
}
|
|
6614
6832
|
}
|
|
6615
6833
|
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
6616
6834
|
}
|
|
@@ -6672,28 +6890,29 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
6672
6890
|
yearOffset++;
|
|
6673
6891
|
}
|
|
6674
6892
|
}
|
|
6675
|
-
_allYearlyComplex(iterator) {
|
|
6893
|
+
_allYearlyComplex(iterator, queryLowerBound) {
|
|
6676
6894
|
const dates = [];
|
|
6895
|
+
const work = this.createCandidateWorkBudget();
|
|
6677
6896
|
let iterationCount = 0;
|
|
6678
6897
|
const start = this.originalDtstart;
|
|
6679
6898
|
if (!this.addDtstartIfNeeded(dates, iterator)) return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
6899
|
+
if (this.opts.until && Temporal.ZonedDateTime.compare(this.opts.until, start) < 0) return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
6680
6900
|
let yearCursor = start.with({
|
|
6681
6901
|
month: 1,
|
|
6682
6902
|
day: 1
|
|
6683
6903
|
});
|
|
6904
|
+
const lastGenerationYear = this.opts.until ? this.opts.until.withTimeZone(this.tzid).year + (this.opts.byWeekNo ? 1 : 0) : void 0;
|
|
6684
6905
|
while (true) {
|
|
6685
6906
|
if (++iterationCount > this.maxIterations) throw new Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);
|
|
6686
|
-
const
|
|
6687
|
-
|
|
6688
|
-
if (occs.length > 0) {
|
|
6689
|
-
uniqueOccs.push(occs[0]);
|
|
6690
|
-
for (let i = 1; i < occs.length; i++) if (Temporal.ZonedDateTime.compare(occs[i], occs[i - 1]) !== 0) uniqueOccs.push(occs[i]);
|
|
6691
|
-
}
|
|
6692
|
-
const { shouldBreak } = this.processOccurrences(uniqueOccs, dates, start, iterator);
|
|
6693
|
-
if (shouldBreak) break;
|
|
6907
|
+
const dateCandidates = this.generateYearlyDateCandidates(yearCursor);
|
|
6908
|
+
if (!this.visitPeriodCandidates(dateCandidates, (candidate) => this.processOccurrence(candidate, dates, start, iterator, void 0, work), queryLowerBound ?? start, this.opts.until, work)) break;
|
|
6694
6909
|
const interval = this.opts.freq === "WEEKLY" ? 1 : this.opts.interval;
|
|
6695
|
-
|
|
6696
|
-
|
|
6910
|
+
try {
|
|
6911
|
+
yearCursor = yearCursor.add({ years: interval });
|
|
6912
|
+
} catch {
|
|
6913
|
+
break;
|
|
6914
|
+
}
|
|
6915
|
+
if (lastGenerationYear !== void 0 && yearCursor.year > lastGenerationYear) break;
|
|
6697
6916
|
}
|
|
6698
6917
|
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
6699
6918
|
}
|
|
@@ -6718,8 +6937,9 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
6718
6937
|
}
|
|
6719
6938
|
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
6720
6939
|
}
|
|
6721
|
-
_allMonthlyByWeekNo(iterator) {
|
|
6940
|
+
_allMonthlyByWeekNo(iterator, queryLowerBound) {
|
|
6722
6941
|
const dates = [];
|
|
6942
|
+
const work = this.createCandidateWorkBudget();
|
|
6723
6943
|
let iterationCount = 0;
|
|
6724
6944
|
const start = this.originalDtstart;
|
|
6725
6945
|
if (!this.addDtstartIfNeeded(dates, iterator)) return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
@@ -6734,15 +6954,7 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
6734
6954
|
const year = current.year;
|
|
6735
6955
|
if (year !== lastYearProcessed && current.month >= start.month) {
|
|
6736
6956
|
lastYearProcessed = year;
|
|
6737
|
-
for (const weekNo of weekNos)
|
|
6738
|
-
const occs = this.generateOccurrencesForWeekInYear(year, weekNo);
|
|
6739
|
-
for (const occ of occs) if (Temporal.ZonedDateTime.compare(occ, start) >= 0) {
|
|
6740
|
-
if (iterator && this.isExcluded(occ)) continue;
|
|
6741
|
-
if (iterator && !iterator(occ, dates.length)) break outer_loop;
|
|
6742
|
-
dates.push(occ);
|
|
6743
|
-
if (this.shouldBreakForCountLimit(dates.length)) break outer_loop;
|
|
6744
|
-
}
|
|
6745
|
-
}
|
|
6957
|
+
for (const weekNo of weekNos) if (!this.visitDateTimeCandidates(this.generateDateCandidatesForWeekInYear(year, weekNo), 1, (candidate) => this.processOccurrence(candidate, dates, start, iterator, void 0, work), queryLowerBound ?? start, this.opts.until, work)) break outer_loop;
|
|
6746
6958
|
}
|
|
6747
6959
|
monthsAdvanced += interval;
|
|
6748
6960
|
current = start.add({ months: monthsAdvanced });
|
|
@@ -6750,8 +6962,9 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
6750
6962
|
}
|
|
6751
6963
|
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
6752
6964
|
}
|
|
6753
|
-
_allMonthlyByYearDay(iterator) {
|
|
6965
|
+
_allMonthlyByYearDay(iterator, queryLowerBound) {
|
|
6754
6966
|
const dates = [];
|
|
6967
|
+
const work = this.createCandidateWorkBudget();
|
|
6755
6968
|
let iterationCount = 0;
|
|
6756
6969
|
const start = this.originalDtstart;
|
|
6757
6970
|
if (!this.addDtstartIfNeeded(dates, iterator)) return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
@@ -6771,22 +6984,17 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
6771
6984
|
month: 12,
|
|
6772
6985
|
day: 31
|
|
6773
6986
|
}).dayOfYear;
|
|
6987
|
+
const dateCandidates = [];
|
|
6774
6988
|
for (const yd of yearDays) {
|
|
6775
6989
|
const dayNum = yd > 0 ? yd : lastDayOfYear + yd + 1;
|
|
6776
6990
|
if (dayNum <= 0 || dayNum > lastDayOfYear) continue;
|
|
6777
|
-
|
|
6778
|
-
for (const occ of this.expandByTime(baseOcc)) {
|
|
6779
|
-
if (Temporal.ZonedDateTime.compare(occ, start) < 0) continue;
|
|
6780
|
-
if (dates.some((d) => Temporal.ZonedDateTime.compare(d, occ) === 0)) continue;
|
|
6781
|
-
if ((occ.year * 12 + occ.month - startMonthAbs) % interval !== 0) continue;
|
|
6782
|
-
if (!this.matchesByMonth(occ)) continue;
|
|
6783
|
-
if (this.opts.until && Temporal.ZonedDateTime.compare(occ, this.opts.until) > 0) break outer_loop;
|
|
6784
|
-
if (iterator && this.isExcluded(occ)) continue;
|
|
6785
|
-
if (iterator && !iterator(occ, dates.length)) break outer_loop;
|
|
6786
|
-
dates.push(occ);
|
|
6787
|
-
if (this.shouldBreakForCountLimit(dates.length)) break outer_loop;
|
|
6788
|
-
}
|
|
6991
|
+
dateCandidates.push(yearStart.add({ days: dayNum - 1 }));
|
|
6789
6992
|
}
|
|
6993
|
+
if (!this.visitDateTimeCandidates(dateCandidates, 1, (candidate) => {
|
|
6994
|
+
if ((candidate.year * 12 + candidate.month - startMonthAbs) % interval !== 0) return true;
|
|
6995
|
+
if (!this.matchesByMonth(candidate)) return true;
|
|
6996
|
+
return this.processOccurrence(candidate, dates, start, iterator, void 0, work);
|
|
6997
|
+
}, queryLowerBound ?? start, this.opts.until, work)) break outer_loop;
|
|
6790
6998
|
year++;
|
|
6791
6999
|
if (this.opts.until && year > this.opts.until.year + 2) break;
|
|
6792
7000
|
if (!this.opts.until && this.opts.count) {
|
|
@@ -6874,11 +7082,19 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
6874
7082
|
all(iterator) {
|
|
6875
7083
|
if (!iterator && this.opts.cache !== false) {
|
|
6876
7084
|
if (!this.allResultCache) this.allResultCache = this.allInternal();
|
|
6877
|
-
return
|
|
7085
|
+
return this.toPublicDates(this.allResultCache.slice());
|
|
6878
7086
|
}
|
|
6879
|
-
return
|
|
7087
|
+
return this.toPublicDates(this.allInternal(this.toInternalIterator(iterator)));
|
|
6880
7088
|
}
|
|
6881
|
-
allInternal(iterator) {
|
|
7089
|
+
allInternal(iterator, queryLowerBound) {
|
|
7090
|
+
if (this.opts.count === void 0 && !this.opts.until && !iterator) throw new Error("all() requires iterator when no COUNT/UNTIL");
|
|
7091
|
+
if (iterator && (this.opts.rDate || this.opts.exDate)) return this.iterateRecurrenceSet(iterator);
|
|
7092
|
+
if (this.opts.count === 0) return this.applyCountLimitAndMergeRDates([], iterator);
|
|
7093
|
+
if (this.opts.until && Temporal.ZonedDateTime.compare(this.opts.until, this.originalDtstart) < 0) {
|
|
7094
|
+
const dates = [];
|
|
7095
|
+
this.addDtstartIfNeeded(dates, iterator);
|
|
7096
|
+
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
7097
|
+
}
|
|
6882
7098
|
if (this.opts.rscale && [
|
|
6883
7099
|
"CHINESE",
|
|
6884
7100
|
"HEBREW",
|
|
@@ -6888,48 +7104,25 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
6888
7104
|
"YEARLY",
|
|
6889
7105
|
"MONTHLY",
|
|
6890
7106
|
"WEEKLY"
|
|
6891
|
-
].includes(this.opts.freq) || !!this.opts.byYearDay || !!this.opts.byWeekNo || this.opts.byMonthDay && this.opts.byMonthDay.length > 0) return this._allRscaleNonGregorian(iterator);
|
|
7107
|
+
].includes(this.opts.freq) || !!this.opts.byYearDay || !!this.opts.byWeekNo || this.opts.byMonthDay && this.opts.byMonthDay.length > 0) return this._allRscaleNonGregorian(iterator, queryLowerBound);
|
|
6892
7108
|
}
|
|
6893
|
-
if (this.opts.byWeekNo && this.opts.byYearDay) {
|
|
6894
|
-
const
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
hour: 0,
|
|
6898
|
-
minute: 0,
|
|
6899
|
-
second: 0,
|
|
6900
|
-
millisecond: 0
|
|
6901
|
-
});
|
|
6902
|
-
const yearDays = this.opts.byYearDay.map((yd) => {
|
|
6903
|
-
const lastDayOfYear = yearStart.with({
|
|
6904
|
-
month: 12,
|
|
6905
|
-
day: 31
|
|
6906
|
-
}).dayOfYear;
|
|
6907
|
-
return yd > 0 ? yd : lastDayOfYear + yd + 1;
|
|
6908
|
-
});
|
|
6909
|
-
let possibleDate = false;
|
|
6910
|
-
for (const yd of yearDays) {
|
|
6911
|
-
const date = yearStart.add({ days: yd - 1 });
|
|
6912
|
-
if (this.matchesByWeekNo(date)) {
|
|
6913
|
-
possibleDate = true;
|
|
6914
|
-
break;
|
|
6915
|
-
}
|
|
6916
|
-
}
|
|
6917
|
-
if (!possibleDate) return [];
|
|
7109
|
+
if (this.opts.byWeekNo && this.opts.byYearDay && !this.hasPossibleYearDayWeekNoCombination()) {
|
|
7110
|
+
const dates = [];
|
|
7111
|
+
this.addDtstartIfNeeded(dates, iterator);
|
|
7112
|
+
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
6918
7113
|
}
|
|
6919
|
-
if (!this.opts.count && !this.opts.until && !iterator) throw new Error("all() requires iterator when no COUNT/UNTIL");
|
|
6920
|
-
if (iterator && (this.opts.rDate || this.opts.exDate)) return this.iterateRecurrenceSet(iterator);
|
|
6921
7114
|
const utcFastPathDates = this.allUtcFastPath(iterator);
|
|
6922
7115
|
if (utcFastPathDates) return utcFastPathDates;
|
|
6923
7116
|
const tzFastPathDates = this.allTzEpochFastPath(iterator);
|
|
6924
7117
|
if (tzFastPathDates) return tzFastPathDates;
|
|
6925
|
-
if (this.opts.freq === "MONTHLY" && (this.opts.byDay || this.opts.byMonthDay) && !this.opts.byWeekNo) return this._allMonthlyByDayOrMonthDay(iterator);
|
|
6926
|
-
if (this.opts.freq === "WEEKLY" && !(this.opts.byYearDay && this.opts.byYearDay.length > 0) && !(this.opts.byWeekNo && this.opts.byWeekNo.length > 0)) return this._allWeekly(iterator);
|
|
7118
|
+
if (this.opts.freq === "MONTHLY" && (this.opts.byDay || this.opts.byMonthDay) && !this.opts.byWeekNo) return this._allMonthlyByDayOrMonthDay(iterator, queryLowerBound);
|
|
7119
|
+
if (this.opts.freq === "WEEKLY" && !(this.opts.byYearDay && this.opts.byYearDay.length > 0) && !(this.opts.byWeekNo && this.opts.byWeekNo.length > 0)) return this._allWeekly(iterator, queryLowerBound);
|
|
6927
7120
|
if (this.opts.freq === "MONTHLY" && this.opts.byMonth && !this.opts.byDay && !this.opts.byMonthDay && !this.opts.byYearDay) return this._allMonthlyByMonth(iterator);
|
|
6928
7121
|
if (this.opts.freq === "YEARLY" && this.opts.byMonth && !this.opts.byDay && !this.opts.byMonthDay && !this.opts.byYearDay && !this.opts.byWeekNo) return this._allYearlyByMonth(iterator);
|
|
6929
|
-
if (this.opts.freq === "YEARLY" && (this.opts.byDay || this.opts.byMonthDay || this.opts.byYearDay || this.opts.byWeekNo) || this.opts.freq === "WEEKLY" && this.opts.byYearDay && this.opts.byYearDay.length > 0 || this.opts.freq === "WEEKLY" && this.opts.byWeekNo && this.opts.byWeekNo.length > 0) return this._allYearlyComplex(iterator);
|
|
7122
|
+
if (this.opts.freq === "YEARLY" && (this.opts.byDay || this.opts.byMonthDay || this.opts.byYearDay || this.opts.byWeekNo) || this.opts.freq === "WEEKLY" && this.opts.byYearDay && this.opts.byYearDay.length > 0 || this.opts.freq === "WEEKLY" && this.opts.byWeekNo && this.opts.byWeekNo.length > 0) return this._allYearlyComplex(iterator, queryLowerBound);
|
|
6930
7123
|
if ((this.opts.freq === "MINUTELY" || this.opts.freq === "SECONDLY") && (this.opts.byMonth || this.opts.byWeekNo || this.opts.byYearDay || this.opts.byMonthDay || this.opts.byDay)) return this._allMinutelySecondlyComplex(iterator);
|
|
6931
|
-
if (this.opts.freq === "MONTHLY" && this.opts.byWeekNo && this.opts.byWeekNo.length > 0) return this._allMonthlyByWeekNo(iterator);
|
|
6932
|
-
if (this.opts.freq === "MONTHLY" && this.opts.byYearDay && this.opts.byYearDay.length > 0 && !this.opts.byDay && !this.opts.byMonthDay) return this._allMonthlyByYearDay(iterator);
|
|
7124
|
+
if (this.opts.freq === "MONTHLY" && this.opts.byWeekNo && this.opts.byWeekNo.length > 0) return this._allMonthlyByWeekNo(iterator, queryLowerBound);
|
|
7125
|
+
if (this.opts.freq === "MONTHLY" && this.opts.byYearDay && this.opts.byYearDay.length > 0 && !this.opts.byDay && !this.opts.byMonthDay) return this._allMonthlyByYearDay(iterator, queryLowerBound);
|
|
6933
7126
|
if (this.opts.rscale && this.opts.freq === "MONTHLY" && !this.opts.byDay && !this.opts.byMonthDay && !this.opts.byWeekNo && !this.opts.byYearDay) return this._allMonthlyRscaleSimple(iterator);
|
|
6934
7127
|
if ((this.opts.freq === "MINUTELY" || this.opts.freq === "HOURLY" || this.opts.freq === "DAILY") && this.opts.bySetPos) return this._allDailyMinutelyHourlyWithBySetPos(iterator);
|
|
6935
7128
|
return this._allFallback(iterator);
|
|
@@ -7185,14 +7378,17 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
7185
7378
|
const startInst = after instanceof Date ? Temporal.Instant.from(after.toISOString()) : normalizeZonedDateTime(after, "after").toInstant();
|
|
7186
7379
|
const endInst = before instanceof Date ? Temporal.Instant.from(before.toISOString()) : normalizeZonedDateTime(before, "before").toInstant();
|
|
7187
7380
|
const numericResult = this.tryNumericBetween(startInst.epochNanoseconds, endInst.epochNanoseconds, inc);
|
|
7188
|
-
if (numericResult.handled) return
|
|
7381
|
+
if (numericResult.handled) return this.toPublicDates(numericResult.value);
|
|
7189
7382
|
const startZdt = Temporal.Instant.from(startInst).toZonedDateTimeISO(this.tzid);
|
|
7190
7383
|
const beforeZdt = Temporal.Instant.from(endInst).toZonedDateTimeISO(this.tzid);
|
|
7191
7384
|
const tempOpts = { ...this.opts };
|
|
7192
7385
|
if (!tempOpts.until || Temporal.ZonedDateTime.compare(beforeZdt, tempOpts.until) < 0) tempOpts.until = beforeZdt;
|
|
7193
7386
|
if (tempOpts.count === void 0) tempOpts.dtstart = this.jumpAlignedDtstart(startZdt);
|
|
7194
|
-
const allDates = new RRuleTemporal(
|
|
7195
|
-
|
|
7387
|
+
const allDates = new RRuleTemporal({
|
|
7388
|
+
...tempOpts,
|
|
7389
|
+
temporal: this.outputTemporal
|
|
7390
|
+
}).allInternal(void 0, tempOpts.count === void 0 ? startZdt : void 0);
|
|
7391
|
+
return this.toPublicDates(allDates.filter((date) => {
|
|
7196
7392
|
const inst = date.toInstant();
|
|
7197
7393
|
const afterStart = inc ? Temporal.Instant.compare(inst, startInst) >= 0 : Temporal.Instant.compare(inst, startInst) > 0;
|
|
7198
7394
|
const beforeEnd = inc ? Temporal.Instant.compare(inst, endInst) <= 0 : Temporal.Instant.compare(inst, endInst) < 0;
|
|
@@ -7298,7 +7494,7 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
7298
7494
|
next(after = /* @__PURE__ */ new Date(), inc = false) {
|
|
7299
7495
|
const afterInst = after instanceof Date ? Temporal.Instant.from(after.toISOString()) : normalizeZonedDateTime(after, "after").toInstant();
|
|
7300
7496
|
const numericResult = this.tryNumericNext(afterInst.epochNanoseconds, inc);
|
|
7301
|
-
if (numericResult.handled) return
|
|
7497
|
+
if (numericResult.handled) return this.toPublicDate(numericResult.value);
|
|
7302
7498
|
let result = null;
|
|
7303
7499
|
const scanFrom = (rule) => {
|
|
7304
7500
|
rule.allInternal((occ) => {
|
|
@@ -7312,7 +7508,7 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
7312
7508
|
};
|
|
7313
7509
|
if (this.opts.count !== void 0) scanFrom(this);
|
|
7314
7510
|
else scanFrom(this.ruleFromAlignedDtstart(afterInst.toZonedDateTimeISO(this.tzid)));
|
|
7315
|
-
return
|
|
7511
|
+
return this.toPublicDate(result);
|
|
7316
7512
|
}
|
|
7317
7513
|
/**
|
|
7318
7514
|
* Build a temporary rule identical to this one but starting at the
|
|
@@ -7324,6 +7520,7 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
7324
7520
|
if (aligned.epochNanoseconds === this.originalDtstart.epochNanoseconds) return this;
|
|
7325
7521
|
return new RRuleTemporal({
|
|
7326
7522
|
...this.opts,
|
|
7523
|
+
temporal: this.outputTemporal,
|
|
7327
7524
|
dtstart: aligned,
|
|
7328
7525
|
includeDtstart: false
|
|
7329
7526
|
});
|
|
@@ -7337,7 +7534,7 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
7337
7534
|
previous(before = /* @__PURE__ */ new Date(), inc = false) {
|
|
7338
7535
|
const beforeInst = before instanceof Date ? Temporal.Instant.from(before.toISOString()) : normalizeZonedDateTime(before, "before").toInstant();
|
|
7339
7536
|
const numericResult = this.tryNumericPrevious(beforeInst.epochNanoseconds, inc);
|
|
7340
|
-
if (numericResult.handled) return
|
|
7537
|
+
if (numericResult.handled) return this.toPublicDate(numericResult.value);
|
|
7341
7538
|
const scanFrom = (rule) => {
|
|
7342
7539
|
let prev = null;
|
|
7343
7540
|
rule.allInternal((occ) => {
|
|
@@ -7348,7 +7545,7 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
7348
7545
|
});
|
|
7349
7546
|
return prev;
|
|
7350
7547
|
};
|
|
7351
|
-
if (this.opts.count !== void 0) return
|
|
7548
|
+
if (this.opts.count !== void 0) return this.toPublicDate(scanFrom(this));
|
|
7352
7549
|
const beforeZdt = beforeInst.toZonedDateTimeISO(this.tzid);
|
|
7353
7550
|
const anchor = this.opts.until && Temporal.ZonedDateTime.compare(this.opts.until, beforeZdt) < 0 ? this.opts.until : beforeZdt;
|
|
7354
7551
|
const interval = this.opts.interval ?? 1;
|
|
@@ -7356,9 +7553,9 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
7356
7553
|
const target = backoff === 0 ? anchor : anchor.subtract(this.freqDuration(interval * 4 ** backoff));
|
|
7357
7554
|
const rule = this.ruleFromAlignedDtstart(target);
|
|
7358
7555
|
const prev = scanFrom(rule);
|
|
7359
|
-
if (prev || rule === this) return
|
|
7556
|
+
if (prev || rule === this) return this.toPublicDate(prev);
|
|
7360
7557
|
}
|
|
7361
|
-
return
|
|
7558
|
+
return this.toPublicDate(scanFrom(this));
|
|
7362
7559
|
}
|
|
7363
7560
|
/** A duration of `count` steps in this rule's frequency unit. */
|
|
7364
7561
|
freqDuration(count) {
|
|
@@ -7405,22 +7602,25 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
7405
7602
|
return dates.map((d) => this.formatIcsDateTime(d));
|
|
7406
7603
|
}
|
|
7407
7604
|
/**
|
|
7408
|
-
*
|
|
7409
|
-
*
|
|
7605
|
+
* Resolve the calendar dates selected within a month without expanding any
|
|
7606
|
+
* time BY-parts. This keeps the intermediate set bounded to calendar scale.
|
|
7410
7607
|
*/
|
|
7411
|
-
|
|
7608
|
+
generateMonthlyDateCandidates(sample) {
|
|
7412
7609
|
const monthStart = sample.day === 1 ? sample : sample.with({ day: 1 });
|
|
7413
|
-
if (!this.opts.byDay && !this.opts.byMonthDay) return
|
|
7610
|
+
if (!this.opts.byDay && !this.opts.byMonthDay) return [sample];
|
|
7414
7611
|
const finalDays = this.generateMonthlyOccurrenceDays(monthStart);
|
|
7415
7612
|
if (finalDays.length === 0) return [];
|
|
7416
|
-
return finalDays.map((
|
|
7613
|
+
return finalDays.map((day) => monthStart.with({ day }));
|
|
7614
|
+
}
|
|
7615
|
+
generateMonthlyOccurrences(sample) {
|
|
7616
|
+
return this.generateMonthlyDateCandidates(sample).flatMap((date) => this.expandByTime(date));
|
|
7417
7617
|
}
|
|
7418
7618
|
/**
|
|
7419
|
-
*
|
|
7420
|
-
*
|
|
7421
|
-
*
|
|
7619
|
+
* Resolve one recurrence year's matching calendar dates. BYHOUR,
|
|
7620
|
+
* BYMINUTE, BYSECOND, and BYSETPOS deliberately remain outside this helper;
|
|
7621
|
+
* callers consume the date x time product incrementally.
|
|
7422
7622
|
*/
|
|
7423
|
-
|
|
7623
|
+
generateYearlyDateCandidates(sample) {
|
|
7424
7624
|
const months = this.opts.byMonth ? this.opts.byMonth.filter((v) => typeof v === "number").sort((a, b) => a - b) : this.opts.byMonthDay || this.opts.byDay ? [
|
|
7425
7625
|
1,
|
|
7426
7626
|
2,
|
|
@@ -7459,7 +7659,7 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
7459
7659
|
const delta = (dec31.dayOfWeek - wd + 7) % 7;
|
|
7460
7660
|
dt = dec31.subtract({ days: delta + 7 * (-ord - 1) });
|
|
7461
7661
|
}
|
|
7462
|
-
occs.push(
|
|
7662
|
+
occs.push(dt);
|
|
7463
7663
|
}
|
|
7464
7664
|
} else if (!this.opts.byYearDay && !this.opts.byWeekNo) {
|
|
7465
7665
|
occs = [];
|
|
@@ -7468,17 +7668,17 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
7468
7668
|
month: m,
|
|
7469
7669
|
day: 1
|
|
7470
7670
|
});
|
|
7471
|
-
const monthOccs = this.
|
|
7671
|
+
const monthOccs = this.generateMonthlyDateCandidates(monthSample);
|
|
7472
7672
|
if (monthOccs.length === 0 && this.opts.rscale && this.opts.byMonthDay && this.opts.byMonthDay.length > 0) {
|
|
7473
7673
|
const lastDay = monthSample.add({ months: 1 }).subtract({ days: 1 }).day;
|
|
7474
7674
|
const target = this.opts.byMonthDay[0];
|
|
7475
7675
|
const absTarget = target > 0 ? target : lastDay + target + 1;
|
|
7476
7676
|
if (absTarget > lastDay || absTarget <= 0) {
|
|
7477
7677
|
const skip = this.opts.skip || "OMIT";
|
|
7478
|
-
if (skip === "BACKWARD") occs.push(
|
|
7678
|
+
if (skip === "BACKWARD") occs.push(monthSample.with({ day: lastDay }));
|
|
7479
7679
|
else if (skip === "FORWARD") {
|
|
7480
7680
|
const nextMonth = monthSample.add({ months: 1 }).with({ day: 1 });
|
|
7481
|
-
occs.push(
|
|
7681
|
+
occs.push(nextMonth);
|
|
7482
7682
|
}
|
|
7483
7683
|
}
|
|
7484
7684
|
} else occs.push(...monthOccs);
|
|
@@ -7503,7 +7703,7 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
7503
7703
|
month: 1,
|
|
7504
7704
|
day: 1
|
|
7505
7705
|
}).add({ days: dayNum - 1 });
|
|
7506
|
-
if (!this.opts.byMonth || this.opts.byMonth.includes(dt.month)) occs.push(
|
|
7706
|
+
if (!this.opts.byMonth || this.opts.byMonth.includes(dt.month)) occs.push(dt);
|
|
7507
7707
|
}
|
|
7508
7708
|
}
|
|
7509
7709
|
if (this.opts.byWeekNo) {
|
|
@@ -7512,14 +7712,12 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
7512
7712
|
if (weekNo > 0 && weekNo > lastWeek || weekNo < 0 && -weekNo > lastWeek) continue;
|
|
7513
7713
|
const weekIndex = weekNo > 0 ? weekNo - 1 : lastWeek + weekNo;
|
|
7514
7714
|
const weekStart = firstWeekStart.add({ weeks: weekIndex });
|
|
7515
|
-
occs.push(...this.
|
|
7715
|
+
occs.push(...this.addByDayDates(tokens, weekStart));
|
|
7516
7716
|
}
|
|
7517
7717
|
}
|
|
7518
|
-
|
|
7519
|
-
occs = this.applyBySetPos(occs);
|
|
7520
|
-
return occs;
|
|
7718
|
+
return this.sortedUniqueDateCandidates(occs);
|
|
7521
7719
|
}
|
|
7522
|
-
|
|
7720
|
+
addByDayDates(tokens, weekStart) {
|
|
7523
7721
|
const dayMap = weekdayToIsoDay;
|
|
7524
7722
|
const wkst = dayMap[this.opts.wkst || "MO"];
|
|
7525
7723
|
const entries = [];
|
|
@@ -7527,9 +7725,9 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
7527
7725
|
if (!tok) continue;
|
|
7528
7726
|
const targetDow = dayMap[tok];
|
|
7529
7727
|
const inst = weekStart.add({ days: (targetDow - wkst + 7) % 7 });
|
|
7530
|
-
if (!this.opts.byMonth || this.opts.byMonth.includes(inst.month)) entries.push(
|
|
7728
|
+
if (!this.opts.byMonth || this.opts.byMonth.includes(inst.month)) entries.push(inst);
|
|
7531
7729
|
}
|
|
7532
|
-
return entries;
|
|
7730
|
+
return this.sortedUniqueDateCandidates(entries);
|
|
7533
7731
|
}
|
|
7534
7732
|
/**
|
|
7535
7733
|
* Helper to find the next valid value from a sorted array
|
|
@@ -7772,7 +7970,7 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
7772
7970
|
/**
|
|
7773
7971
|
* Generate occurrences for a specific week number in a given year
|
|
7774
7972
|
*/
|
|
7775
|
-
|
|
7973
|
+
generateDateCandidatesForWeekInYear(year, weekNo) {
|
|
7776
7974
|
const occs = [];
|
|
7777
7975
|
const sample = this.originalDtstart.with({
|
|
7778
7976
|
year,
|
|
@@ -7783,8 +7981,8 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
7783
7981
|
if (weekNo > 0 && weekNo > lastWeek || weekNo < 0 && -weekNo > lastWeek) return occs;
|
|
7784
7982
|
const weekIndex = weekNo > 0 ? weekNo - 1 : lastWeek + weekNo;
|
|
7785
7983
|
const weekStart = firstWeekStart.add({ weeks: weekIndex });
|
|
7786
|
-
occs.push(...this.
|
|
7787
|
-
return
|
|
7984
|
+
occs.push(...this.addByDayDates(tokens, weekStart));
|
|
7985
|
+
return this.sortedUniqueDateCandidates(occs);
|
|
7788
7986
|
}
|
|
7789
7987
|
getRscaleCalendarId() {
|
|
7790
7988
|
return {
|
|
@@ -7974,11 +8172,12 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
7974
8172
|
}
|
|
7975
8173
|
return this.applyBySetPos(occs).sort((a, b) => Temporal.ZonedDateTime.compare(a, b));
|
|
7976
8174
|
}
|
|
7977
|
-
_allRscaleNonGregorian(iterator) {
|
|
8175
|
+
_allRscaleNonGregorian(iterator, queryLowerBound) {
|
|
7978
8176
|
const calId = this.getRscaleCalendarId();
|
|
7979
8177
|
if (!calId) return this._allFallback(iterator);
|
|
7980
8178
|
this.assertRscaleCalendarSupported(calId);
|
|
7981
8179
|
const dates = [];
|
|
8180
|
+
const work = this.createCandidateWorkBudget();
|
|
7982
8181
|
let iterationCount = 0;
|
|
7983
8182
|
const start = this.originalDtstart;
|
|
7984
8183
|
const seed = this.toRscaleZdt(start).withCalendar(calId);
|
|
@@ -8051,9 +8250,7 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
8051
8250
|
for (const ms of monthStarts) occs.push(...this.generateMonthlyOccurrencesRscale(calId, tgtYear, ms));
|
|
8052
8251
|
}
|
|
8053
8252
|
if (occs.length > 0) {
|
|
8054
|
-
|
|
8055
|
-
const { shouldBreak } = this.processOccurrences(sorted, dates, start, iterator);
|
|
8056
|
-
if (shouldBreak) break;
|
|
8253
|
+
if (!this.visitDateTimeCandidates(occs, 1, (candidate) => this.processOccurrence(candidate, dates, start, iterator, void 0, work), queryLowerBound ?? start, this.opts.until, work)) break;
|
|
8057
8254
|
}
|
|
8058
8255
|
yearOffset++;
|
|
8059
8256
|
if (this.opts.until && tgtYear > this.toRscaleZdt(this.opts.until).withCalendar(calId).year) break;
|
|
@@ -8090,9 +8287,7 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
8090
8287
|
occs.push(this.buildZdtFromPlainDate(pd));
|
|
8091
8288
|
}
|
|
8092
8289
|
if (occs.length) {
|
|
8093
|
-
|
|
8094
|
-
const { shouldBreak } = this.processOccurrences(sorted, dates, start, iterator);
|
|
8095
|
-
if (shouldBreak) return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
8290
|
+
if (!this.visitDateTimeCandidates(occs, 1, (candidate) => this.processOccurrence(candidate, dates, start, iterator, void 0, work), queryLowerBound ?? start, this.opts.until, work)) return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
8096
8291
|
}
|
|
8097
8292
|
weekStart = weekStart.add({ weeks: this.opts.interval ?? 1 });
|
|
8098
8293
|
if (this.opts.until) {
|
|
@@ -8112,9 +8307,8 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
8112
8307
|
const monthsTokens = this.opts.byMonth;
|
|
8113
8308
|
if (monthsTokens && monthsTokens.length > 0) proceed = monthsTokens.some((tok) => this.monthMatchesToken(monthStart.monthCode, tok));
|
|
8114
8309
|
if (proceed) {
|
|
8115
|
-
const
|
|
8116
|
-
|
|
8117
|
-
if (shouldBreak) break;
|
|
8310
|
+
const occs = this.generateMonthlyOccurrencesRscale(calId, year, monthStart);
|
|
8311
|
+
if (!this.visitDateTimeCandidates(occs, 1, (candidate) => this.processOccurrence(candidate, dates, start, iterator, void 0, work), queryLowerBound ?? start, this.opts.until, work)) break;
|
|
8118
8312
|
}
|
|
8119
8313
|
cursor = cursor.add({ months: this.opts.interval ?? 1 });
|
|
8120
8314
|
if (this.opts.until) {
|
|
@@ -8130,10 +8324,7 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
8130
8324
|
if (++iterationCount > this.maxIterations) throw new Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);
|
|
8131
8325
|
if (this.rscaleDateMatches(calId, pd)) {
|
|
8132
8326
|
const base = this.buildZdtFromPlainDate(pd);
|
|
8133
|
-
|
|
8134
|
-
occs = this.applyBySetPos(occs);
|
|
8135
|
-
const { shouldBreak } = this.processOccurrences(occs, dates, start, iterator);
|
|
8136
|
-
if (shouldBreak) break;
|
|
8327
|
+
if (!this.visitPeriodCandidates([base], (candidate) => this.processOccurrence(candidate, dates, start, iterator, void 0, work), queryLowerBound ?? start, this.opts.until, work)) break;
|
|
8137
8328
|
}
|
|
8138
8329
|
pd = pd.add({ days: this.opts.interval ?? 1 });
|
|
8139
8330
|
if (this.opts.until) {
|
|
@@ -8153,13 +8344,11 @@ var RRuleTemporal = class RRuleTemporal {
|
|
|
8153
8344
|
if (++iterationCount > this.maxIterations) throw new Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);
|
|
8154
8345
|
if (this.rscaleDateMatches(calId, pd)) {
|
|
8155
8346
|
const base = this.buildZdtFromPlainDate(pd);
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
return
|
|
8160
|
-
});
|
|
8161
|
-
const { shouldBreak } = this.processOccurrences(occs, dates, start, iterator);
|
|
8162
|
-
if (shouldBreak) break;
|
|
8347
|
+
if (!this.visitDateTimeCandidates([base], 1, (candidate) => {
|
|
8348
|
+
const delta = candidate.toInstant().epochMilliseconds - startInstantMs;
|
|
8349
|
+
if (Math.floor(delta / unitMs) % interval !== 0) return true;
|
|
8350
|
+
return this.processOccurrence(candidate, dates, start, iterator, void 0, work);
|
|
8351
|
+
}, queryLowerBound ?? start, this.opts.until, work)) break;
|
|
8163
8352
|
}
|
|
8164
8353
|
pd = pd.add({ days: 1 });
|
|
8165
8354
|
if (this.opts.until) {
|