rrule-temporal 1.1.12 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +83 -10
- package/dist/{chunk-AVHF452E.js → chunk-PDW5N23H.js} +562 -19
- package/dist/index.cjs +562 -19
- package/dist/index.d.cts +31 -2
- package/dist/index.d.ts +31 -2
- package/dist/index.js +1 -1
- package/dist/totext.cjs +567 -19
- package/dist/totext.js +6 -1
- package/package.json +1 -1
package/dist/totext.cjs
CHANGED
|
@@ -81,6 +81,14 @@ function parseNumberArray(val, sort = false) {
|
|
|
81
81
|
}
|
|
82
82
|
return arr;
|
|
83
83
|
}
|
|
84
|
+
function parseByMonthArray(val) {
|
|
85
|
+
return val.split(",").map((tok) => {
|
|
86
|
+
const t = tok.trim();
|
|
87
|
+
if (/^\d+L$/i.test(t)) return t.toUpperCase();
|
|
88
|
+
const n = parseInt(t, 10);
|
|
89
|
+
return Number.isFinite(n) ? n : t;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
84
92
|
function parseRRuleString(input, targetTimezone) {
|
|
85
93
|
var _a;
|
|
86
94
|
const unfoldedInput = unfoldLine(input).trim();
|
|
@@ -113,10 +121,32 @@ function parseRRuleString(input, targetTimezone) {
|
|
|
113
121
|
exDate: exDate.length > 0 ? exDate : void 0,
|
|
114
122
|
rDate: rDate.length > 0 ? rDate : void 0
|
|
115
123
|
};
|
|
124
|
+
let pendingSkip;
|
|
116
125
|
for (const part of parts) {
|
|
117
126
|
const [key, val] = part.split("=");
|
|
118
127
|
if (!key) continue;
|
|
119
128
|
switch (key.toUpperCase()) {
|
|
129
|
+
case "RSCALE":
|
|
130
|
+
if (val) {
|
|
131
|
+
opts.rscale = val.toUpperCase();
|
|
132
|
+
if (pendingSkip && !opts.skip) {
|
|
133
|
+
opts.skip = pendingSkip;
|
|
134
|
+
pendingSkip = void 0;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
break;
|
|
138
|
+
case "SKIP": {
|
|
139
|
+
const v = (val || "").toUpperCase();
|
|
140
|
+
if (!["OMIT", "BACKWARD", "FORWARD"].includes(v)) {
|
|
141
|
+
throw new Error(`Invalid SKIP value: ${val}`);
|
|
142
|
+
}
|
|
143
|
+
if (opts.rscale) {
|
|
144
|
+
opts.skip = v;
|
|
145
|
+
} else {
|
|
146
|
+
pendingSkip = v;
|
|
147
|
+
}
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
120
150
|
case "FREQ":
|
|
121
151
|
opts.freq = val.toUpperCase();
|
|
122
152
|
break;
|
|
@@ -146,7 +176,7 @@ function parseRRuleString(input, targetTimezone) {
|
|
|
146
176
|
opts.byDay = val.split(",");
|
|
147
177
|
break;
|
|
148
178
|
case "BYMONTH":
|
|
149
|
-
opts.byMonth =
|
|
179
|
+
opts.byMonth = parseByMonthArray(val);
|
|
150
180
|
break;
|
|
151
181
|
case "BYMONTHDAY":
|
|
152
182
|
opts.byMonthDay = parseNumberArray(val);
|
|
@@ -165,6 +195,12 @@ function parseRRuleString(input, targetTimezone) {
|
|
|
165
195
|
break;
|
|
166
196
|
}
|
|
167
197
|
}
|
|
198
|
+
if (pendingSkip && !opts.rscale) {
|
|
199
|
+
throw new Error("SKIP MUST NOT be present unless RSCALE is present");
|
|
200
|
+
}
|
|
201
|
+
if (pendingSkip && opts.rscale && !opts.skip) {
|
|
202
|
+
opts.skip = pendingSkip;
|
|
203
|
+
}
|
|
168
204
|
return opts;
|
|
169
205
|
}
|
|
170
206
|
var RRuleTemporal = class _RRuleTemporal {
|
|
@@ -226,8 +262,18 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
226
262
|
return days.length > 0 ? days : void 0;
|
|
227
263
|
}
|
|
228
264
|
sanitizeOpts(opts) {
|
|
265
|
+
var _a;
|
|
229
266
|
opts.byDay = this.sanitizeByDay(opts.byDay);
|
|
230
|
-
|
|
267
|
+
if (opts.byMonth) {
|
|
268
|
+
const numeric = opts.byMonth.filter((v) => typeof v === "number");
|
|
269
|
+
const stringy = opts.byMonth.filter((v) => typeof v === "string");
|
|
270
|
+
const sanitizedNum = (_a = this.sanitizeNumericArray(numeric, 1, 12, false, false)) != null ? _a : [];
|
|
271
|
+
const merged = [...sanitizedNum, ...stringy];
|
|
272
|
+
opts.byMonth = merged.length > 0 ? merged : void 0;
|
|
273
|
+
}
|
|
274
|
+
if (opts.rscale && !opts.skip) {
|
|
275
|
+
opts.skip = "OMIT";
|
|
276
|
+
}
|
|
231
277
|
opts.byMonthDay = this.sanitizeNumericArray(opts.byMonthDay, -31, 31, false, false);
|
|
232
278
|
opts.byYearDay = this.sanitizeNumericArray(opts.byYearDay, -366, 366, false, false);
|
|
233
279
|
opts.byWeekNo = this.sanitizeNumericArray(opts.byWeekNo, -53, 53, false, false);
|
|
@@ -461,7 +507,7 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
461
507
|
const dayMap = { MO: 1, TU: 2, WE: 3, TH: 4, FR: 5, SA: 6, SU: 7 };
|
|
462
508
|
const hasOrdinalTokens = this.opts.byDay.some((tok) => /^[+-]?\d/.test(tok));
|
|
463
509
|
if (hasOrdinalTokens && this.opts.byMonth && (this.opts.freq === "MINUTELY" || this.opts.freq === "SECONDLY")) {
|
|
464
|
-
const months =
|
|
510
|
+
const months = this.opts.byMonth.filter((v) => typeof v === "number").sort((a, b) => a - b);
|
|
465
511
|
let foundFirst = false;
|
|
466
512
|
for (let year = zdt.year; year <= zdt.year + 10 && !foundFirst; year++) {
|
|
467
513
|
for (const month of months) {
|
|
@@ -564,7 +610,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
564
610
|
matchesByMonth(zdt) {
|
|
565
611
|
const { byMonth } = this.opts;
|
|
566
612
|
if (!byMonth) return true;
|
|
567
|
-
|
|
613
|
+
const nums = byMonth.filter((v) => typeof v === "number");
|
|
614
|
+
if (nums.length === 0) return true;
|
|
615
|
+
return nums.includes(zdt.month);
|
|
568
616
|
}
|
|
569
617
|
matchesNumericConstraint(value, constraints, maxPositiveValue) {
|
|
570
618
|
return constraints.some((c) => {
|
|
@@ -761,7 +809,7 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
761
809
|
if (!this.addDtstartIfNeeded(dates, iterator)) {
|
|
762
810
|
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
763
811
|
}
|
|
764
|
-
const months =
|
|
812
|
+
const months = this.opts.byMonth.filter((v) => typeof v === "number").sort((a, b) => a - b);
|
|
765
813
|
let monthOffset = 0;
|
|
766
814
|
let startMonthIndex = months.findIndex((m) => m >= start.month);
|
|
767
815
|
if (startMonthIndex === -1) {
|
|
@@ -805,7 +853,7 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
805
853
|
if (!this.addDtstartIfNeeded(dates, iterator)) {
|
|
806
854
|
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
807
855
|
}
|
|
808
|
-
const months =
|
|
856
|
+
const months = this.opts.byMonth.filter((v) => typeof v === "number").sort((a, b) => a - b);
|
|
809
857
|
let yearOffset = 0;
|
|
810
858
|
while (true) {
|
|
811
859
|
if (++iterationCount > this.maxIterations) {
|
|
@@ -1100,6 +1148,11 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1100
1148
|
* @returns An array of Temporal.ZonedDateTime objects representing all occurrences of the rule.
|
|
1101
1149
|
*/
|
|
1102
1150
|
all(iterator) {
|
|
1151
|
+
if (this.opts.rscale && ["CHINESE", "HEBREW", "INDIAN"].includes(this.opts.rscale)) {
|
|
1152
|
+
if (["YEARLY", "MONTHLY", "WEEKLY"].includes(this.opts.freq) || !!this.opts.byYearDay || !!this.opts.byWeekNo || this.opts.byMonthDay && this.opts.byMonthDay.length > 0) {
|
|
1153
|
+
return this._allRscaleNonGregorian(iterator);
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1103
1156
|
if (this.opts.byWeekNo && this.opts.byYearDay) {
|
|
1104
1157
|
const yearStart = this.originalDtstart.with({ month: 1, day: 1, hour: 0, minute: 0, second: 0, millisecond: 0 });
|
|
1105
1158
|
const yearDays = this.opts.byYearDay.map((yd) => {
|
|
@@ -1145,11 +1198,68 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1145
1198
|
if (this.opts.freq === "MONTHLY" && this.opts.byYearDay && this.opts.byYearDay.length > 0 && !this.opts.byDay && !this.opts.byMonthDay) {
|
|
1146
1199
|
return this._allMonthlyByYearDay(iterator);
|
|
1147
1200
|
}
|
|
1201
|
+
if (this.opts.rscale && this.opts.freq === "MONTHLY" && !this.opts.byDay && !this.opts.byMonthDay && !this.opts.byWeekNo && !this.opts.byYearDay) {
|
|
1202
|
+
return this._allMonthlyRscaleSimple(iterator);
|
|
1203
|
+
}
|
|
1148
1204
|
if ((this.opts.freq === "MINUTELY" || this.opts.freq === "HOURLY" || this.opts.freq === "DAILY") && this.opts.bySetPos) {
|
|
1149
1205
|
return this._allDailyMinutelyHourlyWithBySetPos(iterator);
|
|
1150
1206
|
}
|
|
1151
1207
|
return this._allFallback(iterator);
|
|
1152
1208
|
}
|
|
1209
|
+
/**
|
|
1210
|
+
* RFC 7529: RSCALE present, simple monthly iteration with SKIP behavior.
|
|
1211
|
+
* Handles month-to-month stepping from DTSTART's year/month aiming for DTSTART's day-of-month.
|
|
1212
|
+
* Applies SKIP=OMIT (skip invalid months), BACKWARD (clamp to last day), FORWARD (first day of next month).
|
|
1213
|
+
*/
|
|
1214
|
+
_allMonthlyRscaleSimple(iterator) {
|
|
1215
|
+
var _a;
|
|
1216
|
+
const dates = [];
|
|
1217
|
+
let iterationCount = 0;
|
|
1218
|
+
const start = this.originalDtstart;
|
|
1219
|
+
const interval = (_a = this.opts.interval) != null ? _a : 1;
|
|
1220
|
+
const targetDom = start.day;
|
|
1221
|
+
if (!this.addDtstartIfNeeded(dates, iterator)) {
|
|
1222
|
+
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
1223
|
+
}
|
|
1224
|
+
let cursor = start.with({ day: 1 });
|
|
1225
|
+
while (true) {
|
|
1226
|
+
if (++iterationCount > this.maxIterations) {
|
|
1227
|
+
throw new Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);
|
|
1228
|
+
}
|
|
1229
|
+
const lastDay = cursor.add({ months: 1 }).subtract({ days: 1 }).day;
|
|
1230
|
+
let occ = null;
|
|
1231
|
+
if (targetDom <= lastDay) {
|
|
1232
|
+
occ = cursor.with({ day: targetDom });
|
|
1233
|
+
} else {
|
|
1234
|
+
const skip = this.opts.skip || "OMIT";
|
|
1235
|
+
if (skip === "BACKWARD") {
|
|
1236
|
+
occ = cursor.with({ day: lastDay });
|
|
1237
|
+
} else if (skip === "FORWARD") {
|
|
1238
|
+
occ = cursor.add({ months: 1 }).with({ day: 1 });
|
|
1239
|
+
} else {
|
|
1240
|
+
occ = null;
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
if (occ) {
|
|
1244
|
+
occ = occ.with({ hour: start.hour, minute: start.minute, second: start.second });
|
|
1245
|
+
if (!(iterator && this.isExcluded(occ))) {
|
|
1246
|
+
if (import_polyfill.Temporal.ZonedDateTime.compare(occ, start) >= 0) {
|
|
1247
|
+
if (!iterator || iterator(occ, dates.length)) {
|
|
1248
|
+
dates.push(occ);
|
|
1249
|
+
if (this.shouldBreakForCountLimit(dates.length)) break;
|
|
1250
|
+
} else {
|
|
1251
|
+
break;
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
cursor = cursor.add({ months: interval });
|
|
1257
|
+
if (this.opts.until && import_polyfill.Temporal.ZonedDateTime.compare(cursor, this.opts.until) > 0) {
|
|
1258
|
+
break;
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
1262
|
+
}
|
|
1153
1263
|
/**
|
|
1154
1264
|
* Converts rDate entries to ZonedDateTime and merges with existing dates.
|
|
1155
1265
|
* @param dates - Array of dates to merge with
|
|
@@ -1370,6 +1480,8 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1370
1480
|
rDate,
|
|
1371
1481
|
exDate
|
|
1372
1482
|
} = this.opts;
|
|
1483
|
+
if (this.opts.rscale) rule.push(`RSCALE=${this.opts.rscale}`);
|
|
1484
|
+
if (this.opts.rscale && this.opts.skip) rule.push(`SKIP=${this.opts.skip}`);
|
|
1373
1485
|
rule.push(`FREQ=${freq}`);
|
|
1374
1486
|
if (interval !== 1) rule.push(`INTERVAL=${interval}`);
|
|
1375
1487
|
if (count !== void 0) rule.push(`COUNT=${count}`);
|
|
@@ -1465,7 +1577,7 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1465
1577
|
* if BYMONTH is not specified.
|
|
1466
1578
|
*/
|
|
1467
1579
|
generateYearlyOccurrences(sample) {
|
|
1468
|
-
const months = this.opts.byMonth ?
|
|
1580
|
+
const months = this.opts.byMonth ? this.opts.byMonth.filter((v) => typeof v === "number").sort((a, b) => a - b) : this.opts.byMonthDay || this.opts.byDay ? [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] : [this.originalDtstart.month];
|
|
1469
1581
|
let occs = [];
|
|
1470
1582
|
const hasOrdinalByDay = this.opts.byDay && this.opts.byDay.some((t) => /^[+-]?\d/.test(t));
|
|
1471
1583
|
if (hasOrdinalByDay && !this.opts.byMonth) {
|
|
@@ -1488,10 +1600,28 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1488
1600
|
occs.push(...this.expandByTime(dt));
|
|
1489
1601
|
}
|
|
1490
1602
|
} else if (!this.opts.byYearDay && !this.opts.byWeekNo) {
|
|
1491
|
-
occs =
|
|
1603
|
+
occs = [];
|
|
1604
|
+
for (const m of months) {
|
|
1492
1605
|
const monthSample = sample.with({ month: m, day: 1 });
|
|
1493
|
-
|
|
1494
|
-
|
|
1606
|
+
const monthOccs = this.generateMonthlyOccurrences(monthSample);
|
|
1607
|
+
if (monthOccs.length === 0 && this.opts.rscale && this.opts.byMonthDay && this.opts.byMonthDay.length > 0) {
|
|
1608
|
+
const lastDay = monthSample.add({ months: 1 }).subtract({ days: 1 }).day;
|
|
1609
|
+
const target = this.opts.byMonthDay[0];
|
|
1610
|
+
const absTarget = target > 0 ? target : lastDay + target + 1;
|
|
1611
|
+
if (absTarget > lastDay || absTarget <= 0) {
|
|
1612
|
+
const skip = this.opts.skip || "OMIT";
|
|
1613
|
+
if (skip === "BACKWARD") {
|
|
1614
|
+
occs.push(...this.expandByTime(monthSample.with({ day: lastDay })));
|
|
1615
|
+
} else if (skip === "FORWARD") {
|
|
1616
|
+
const nextMonth = monthSample.add({ months: 1 }).with({ day: 1 });
|
|
1617
|
+
occs.push(...this.expandByTime(nextMonth));
|
|
1618
|
+
} else {
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
} else {
|
|
1622
|
+
occs.push(...monthOccs);
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1495
1625
|
}
|
|
1496
1626
|
if (this.opts.byYearDay) {
|
|
1497
1627
|
const last = sample.with({ month: 12, day: 31 }).dayOfYear;
|
|
@@ -1557,16 +1687,19 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1557
1687
|
}
|
|
1558
1688
|
}
|
|
1559
1689
|
}
|
|
1560
|
-
if (this.opts.byMonth
|
|
1561
|
-
const
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1690
|
+
if (this.opts.byMonth) {
|
|
1691
|
+
const numericMonths = this.opts.byMonth.filter((v) => typeof v === "number");
|
|
1692
|
+
if (numericMonths.length && !numericMonths.includes(current.month)) {
|
|
1693
|
+
const months = [...numericMonths].sort((a, b) => a - b);
|
|
1694
|
+
const nextMonth = this.findNextValidValue(current.month, months, (a, b) => a - b);
|
|
1695
|
+
if (nextMonth) {
|
|
1696
|
+
current = current.with({ month: nextMonth, day: 1, hour: 0, minute: 0, second: 0 });
|
|
1697
|
+
} else {
|
|
1698
|
+
current = current.add({ years: 1 }).with({ month: months[0], day: 1, hour: 0, minute: 0, second: 0 });
|
|
1699
|
+
}
|
|
1700
|
+
current = this.applyTimeOverride(current);
|
|
1701
|
+
return current;
|
|
1567
1702
|
}
|
|
1568
|
-
current = this.applyTimeOverride(current);
|
|
1569
|
-
return current;
|
|
1570
1703
|
}
|
|
1571
1704
|
if (this.opts.byWeekNo && !this.matchesByWeekNo(current)) {
|
|
1572
1705
|
current = current.add({ weeks: 1 }).with({ hour: 0, minute: 0, second: 0 });
|
|
@@ -1710,6 +1843,416 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1710
1843
|
occs.push(...this.addByDay(tokens, weekStart));
|
|
1711
1844
|
return occs.sort((a, b) => import_polyfill.Temporal.ZonedDateTime.compare(a, b));
|
|
1712
1845
|
}
|
|
1846
|
+
// ===== RSCALE (non-Gregorian) support: Chinese and Hebrew =====
|
|
1847
|
+
getRscaleCalendarId() {
|
|
1848
|
+
var _a;
|
|
1849
|
+
const map = {
|
|
1850
|
+
GREGORIAN: "gregory",
|
|
1851
|
+
CHINESE: "chinese",
|
|
1852
|
+
HEBREW: "hebrew",
|
|
1853
|
+
INDIAN: "indian"
|
|
1854
|
+
};
|
|
1855
|
+
const r = ((_a = this.opts.rscale) == null ? void 0 : _a.toUpperCase()) || "";
|
|
1856
|
+
return map[r] || null;
|
|
1857
|
+
}
|
|
1858
|
+
pad2(n) {
|
|
1859
|
+
return String(n).padStart(2, "0");
|
|
1860
|
+
}
|
|
1861
|
+
monthMatchesToken(monthCode, token) {
|
|
1862
|
+
if (typeof token === "number") {
|
|
1863
|
+
return monthCode === `M${this.pad2(token)}`;
|
|
1864
|
+
}
|
|
1865
|
+
if (/^\d+L$/i.test(token)) {
|
|
1866
|
+
const n = parseInt(token, 10);
|
|
1867
|
+
return monthCode === `M${this.pad2(n)}L`;
|
|
1868
|
+
}
|
|
1869
|
+
return false;
|
|
1870
|
+
}
|
|
1871
|
+
monthsOfYear(calId, year) {
|
|
1872
|
+
const out = [];
|
|
1873
|
+
for (let m = 1; m <= 20; m++) {
|
|
1874
|
+
try {
|
|
1875
|
+
const d = import_polyfill.Temporal.PlainDate.from({ calendar: calId, year, month: m, day: 1 });
|
|
1876
|
+
out.push(d);
|
|
1877
|
+
} catch (e) {
|
|
1878
|
+
break;
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
return out;
|
|
1882
|
+
}
|
|
1883
|
+
startOfYear(calId, year) {
|
|
1884
|
+
return import_polyfill.Temporal.PlainDate.from({ calendar: calId, year, month: 1, day: 1 });
|
|
1885
|
+
}
|
|
1886
|
+
endOfYear(calId, year) {
|
|
1887
|
+
return this.startOfYear(calId, year + 1).subtract({ days: 1 });
|
|
1888
|
+
}
|
|
1889
|
+
rscaleFirstWeekStart(calId, year, wkst) {
|
|
1890
|
+
const jan4 = import_polyfill.Temporal.PlainDate.from({ calendar: calId, year, month: 1, day: 4 });
|
|
1891
|
+
const delta = (jan4.dayOfWeek - wkst + 7) % 7;
|
|
1892
|
+
return jan4.subtract({ days: delta });
|
|
1893
|
+
}
|
|
1894
|
+
rscaleLastWeekCount(calId, year, wkst) {
|
|
1895
|
+
const firstWeekStart = this.rscaleFirstWeekStart(calId, year, wkst);
|
|
1896
|
+
const lastDay = this.endOfYear(calId, year);
|
|
1897
|
+
const diffDays = lastDay.since(firstWeekStart).days;
|
|
1898
|
+
return Math.floor(diffDays / 7) + 1;
|
|
1899
|
+
}
|
|
1900
|
+
lastDayOfMonth(pd) {
|
|
1901
|
+
return pd.with({ day: 1 }).add({ months: 1 }).subtract({ days: 1 }).day;
|
|
1902
|
+
}
|
|
1903
|
+
buildZdtFromPlainDate(pd) {
|
|
1904
|
+
const t = this.originalDtstart;
|
|
1905
|
+
const pdt = import_polyfill.Temporal.PlainDateTime.from({
|
|
1906
|
+
calendar: pd.calendarId,
|
|
1907
|
+
year: pd.year,
|
|
1908
|
+
month: pd.month,
|
|
1909
|
+
day: pd.day,
|
|
1910
|
+
hour: t.hour,
|
|
1911
|
+
minute: t.minute,
|
|
1912
|
+
second: t.second
|
|
1913
|
+
});
|
|
1914
|
+
return pdt.toZonedDateTime(this.tzid);
|
|
1915
|
+
}
|
|
1916
|
+
rscaleMatchesByYearDay(calId, pd) {
|
|
1917
|
+
const list2 = this.opts.byYearDay;
|
|
1918
|
+
if (!list2 || list2.length === 0) return true;
|
|
1919
|
+
const last = this.endOfYear(calId, pd.year).dayOfYear;
|
|
1920
|
+
return list2.some((d) => d > 0 ? pd.dayOfYear === d : pd.dayOfYear === last + d + 1);
|
|
1921
|
+
}
|
|
1922
|
+
rscaleMatchesByWeekNo(calId, pd) {
|
|
1923
|
+
const list2 = this.opts.byWeekNo;
|
|
1924
|
+
if (!list2 || list2.length === 0) return true;
|
|
1925
|
+
const dayMap = { MO: 1, TU: 2, WE: 3, TH: 4, FR: 5, SA: 6, SU: 7 };
|
|
1926
|
+
const wkst = dayMap[this.opts.wkst || "MO"];
|
|
1927
|
+
const weekStart = pd.subtract({ days: (pd.dayOfWeek - wkst + 7) % 7 });
|
|
1928
|
+
const thursday = weekStart.add({ days: (4 - wkst + 7) % 7 });
|
|
1929
|
+
const weekYear = thursday.year;
|
|
1930
|
+
const firstStart = this.rscaleFirstWeekStart(calId, weekYear, wkst);
|
|
1931
|
+
const lastWeek = this.rscaleLastWeekCount(calId, weekYear, wkst);
|
|
1932
|
+
const idx = Math.floor(pd.since(firstStart).days / 7) + 1;
|
|
1933
|
+
return list2.some((wn) => wn > 0 ? idx === wn : idx === lastWeek + wn + 1);
|
|
1934
|
+
}
|
|
1935
|
+
rscaleMatchesByMonth(calId, pd) {
|
|
1936
|
+
const tokens = this.opts.byMonth;
|
|
1937
|
+
if (!tokens || tokens.length === 0) return true;
|
|
1938
|
+
return tokens.some((tok) => this.monthMatchesToken(pd.monthCode, tok));
|
|
1939
|
+
}
|
|
1940
|
+
rscaleMatchesByMonthDay(pd) {
|
|
1941
|
+
const list2 = this.opts.byMonthDay;
|
|
1942
|
+
if (!list2 || list2.length === 0) return true;
|
|
1943
|
+
const last = pd.with({ day: 1 }).add({ months: 1 }).subtract({ days: 1 }).day;
|
|
1944
|
+
const value = pd.day;
|
|
1945
|
+
return list2.some((d) => d > 0 ? value === d : value === last + d + 1);
|
|
1946
|
+
}
|
|
1947
|
+
rscaleMatchesByDayBasic(pd) {
|
|
1948
|
+
const byDay = this.opts.byDay;
|
|
1949
|
+
if (!byDay || byDay.length === 0) return true;
|
|
1950
|
+
const dayMap = { MO: 1, TU: 2, WE: 3, TH: 4, FR: 5, SA: 6, SU: 7 };
|
|
1951
|
+
const tokens = byDay.map((tok) => {
|
|
1952
|
+
var _a;
|
|
1953
|
+
return (_a = tok.match(/^(?:[+-]?\d{1,2})?(MO|TU|WE|TH|FR|SA|SU)$/)) == null ? void 0 : _a[1];
|
|
1954
|
+
}).filter((x) => !!x);
|
|
1955
|
+
if (tokens.length === 0) return true;
|
|
1956
|
+
return tokens.some((wd) => dayMap[wd] === pd.dayOfWeek);
|
|
1957
|
+
}
|
|
1958
|
+
rscaleDateMatches(calId, pd) {
|
|
1959
|
+
return this.rscaleMatchesByMonth(calId, pd) && this.rscaleMatchesByYearDay(calId, pd) && this.rscaleMatchesByWeekNo(calId, pd) && this.rscaleMatchesByMonthDay(pd) && this.rscaleMatchesByDayBasic(pd);
|
|
1960
|
+
}
|
|
1961
|
+
applySkipForDay(calId, year, monthStart, targetDay) {
|
|
1962
|
+
const last = this.lastDayOfMonth(monthStart);
|
|
1963
|
+
const skip = this.opts.skip || "OMIT";
|
|
1964
|
+
if (targetDay >= 1 && targetDay <= last) {
|
|
1965
|
+
return monthStart.with({ day: targetDay });
|
|
1966
|
+
}
|
|
1967
|
+
if (skip === "BACKWARD") {
|
|
1968
|
+
return monthStart.with({ day: last });
|
|
1969
|
+
}
|
|
1970
|
+
if (skip === "FORWARD") {
|
|
1971
|
+
const nextMonthStart = monthStart.add({ months: 1 });
|
|
1972
|
+
return nextMonthStart.with({ day: 1 });
|
|
1973
|
+
}
|
|
1974
|
+
return null;
|
|
1975
|
+
}
|
|
1976
|
+
generateMonthlyOccurrencesRscale(calId, year, monthStart) {
|
|
1977
|
+
const occs = [];
|
|
1978
|
+
const byMonthDay = this.opts.byMonthDay;
|
|
1979
|
+
const byDay = this.opts.byDay;
|
|
1980
|
+
if (!byDay && !byMonthDay) {
|
|
1981
|
+
const targetDay = this.originalDtstart.withCalendar(calId).day;
|
|
1982
|
+
const pd = this.applySkipForDay(calId, year, monthStart, targetDay);
|
|
1983
|
+
if (pd) occs.push(this.buildZdtFromPlainDate(pd));
|
|
1984
|
+
return occs;
|
|
1985
|
+
}
|
|
1986
|
+
const addZ = (pd) => {
|
|
1987
|
+
occs.push(this.buildZdtFromPlainDate(pd));
|
|
1988
|
+
};
|
|
1989
|
+
const last = this.lastDayOfMonth(monthStart);
|
|
1990
|
+
const resolveDay = (d) => d > 0 ? d : last + d + 1;
|
|
1991
|
+
if (byMonthDay && byMonthDay.length > 0) {
|
|
1992
|
+
for (const raw of byMonthDay) {
|
|
1993
|
+
const dayNum = resolveDay(raw);
|
|
1994
|
+
const pd = this.applySkipForDay(calId, year, monthStart, dayNum);
|
|
1995
|
+
if (pd) addZ(pd);
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
if (byDay && byDay.length > 0) {
|
|
1999
|
+
const dayMap = { MO: 1, TU: 2, WE: 3, TH: 4, FR: 5, SA: 6, SU: 7 };
|
|
2000
|
+
const buckets = {};
|
|
2001
|
+
let cur = monthStart;
|
|
2002
|
+
while (cur.month === monthStart.month && cur.year === monthStart.year) {
|
|
2003
|
+
const wd = cur.dayOfWeek;
|
|
2004
|
+
(buckets[wd] || (buckets[wd] = [])).push(cur);
|
|
2005
|
+
cur = cur.add({ days: 1 });
|
|
2006
|
+
}
|
|
2007
|
+
for (const tok of byDay) {
|
|
2008
|
+
const m = tok.match(/^([+-]?\d{1,2})?(MO|TU|WE|TH|FR|SA|SU)$/);
|
|
2009
|
+
if (!m) continue;
|
|
2010
|
+
const ord = m[1] ? parseInt(m[1], 10) : 0;
|
|
2011
|
+
const wd = dayMap[m[2]];
|
|
2012
|
+
const list2 = buckets[wd] || [];
|
|
2013
|
+
if (list2.length === 0) continue;
|
|
2014
|
+
if (ord === 0) {
|
|
2015
|
+
for (const pd of list2) addZ(pd);
|
|
2016
|
+
} else {
|
|
2017
|
+
const idx = ord > 0 ? ord - 1 : list2.length + ord;
|
|
2018
|
+
const pd = list2[idx];
|
|
2019
|
+
if (pd) addZ(pd);
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
return this.applyBySetPos(occs).sort((a, b) => import_polyfill.Temporal.ZonedDateTime.compare(a, b));
|
|
2024
|
+
}
|
|
2025
|
+
_allRscaleNonGregorian(iterator) {
|
|
2026
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2027
|
+
const calId = this.getRscaleCalendarId();
|
|
2028
|
+
if (!calId) return this._allFallback(iterator);
|
|
2029
|
+
const dates = [];
|
|
2030
|
+
let iterationCount = 0;
|
|
2031
|
+
const start = this.originalDtstart;
|
|
2032
|
+
const seed = start.withCalendar(calId);
|
|
2033
|
+
const interval = (_a = this.opts.interval) != null ? _a : 1;
|
|
2034
|
+
if (!this.addDtstartIfNeeded(dates, iterator)) {
|
|
2035
|
+
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
2036
|
+
}
|
|
2037
|
+
if (this.opts.freq === "YEARLY") {
|
|
2038
|
+
let yearOffset = 0;
|
|
2039
|
+
while (true) {
|
|
2040
|
+
if (++iterationCount > this.maxIterations) {
|
|
2041
|
+
throw new Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);
|
|
2042
|
+
}
|
|
2043
|
+
const tgtYear = seed.year + yearOffset * interval;
|
|
2044
|
+
let occs = [];
|
|
2045
|
+
const monthsTokens = this.opts.byMonth;
|
|
2046
|
+
const months = this.monthsOfYear(calId, tgtYear);
|
|
2047
|
+
const dayMap = { MO: 1, TU: 2, WE: 3, TH: 4, FR: 5, SA: 6, SU: 7 };
|
|
2048
|
+
const wkst = dayMap[this.opts.wkst || "MO"];
|
|
2049
|
+
if (this.opts.byWeekNo && this.opts.byWeekNo.length > 0) {
|
|
2050
|
+
const firstStart = this.rscaleFirstWeekStart(calId, tgtYear, wkst);
|
|
2051
|
+
const lastWeek = this.rscaleLastWeekCount(calId, tgtYear, wkst);
|
|
2052
|
+
const tokens = ((_b = this.opts.byDay) == null ? void 0 : _b.length) ? this.opts.byDay.map((tok) => {
|
|
2053
|
+
var _a2;
|
|
2054
|
+
return (_a2 = tok.match(/(MO|TU|WE|TH|FR|SA|SU)$/)) == null ? void 0 : _a2[1];
|
|
2055
|
+
}) : [Object.entries(dayMap).find(([, d]) => d === this.originalDtstart.dayOfWeek)[0]];
|
|
2056
|
+
for (const wn of this.opts.byWeekNo) {
|
|
2057
|
+
let idx = wn > 0 ? wn - 1 : lastWeek + wn;
|
|
2058
|
+
if (idx < 0 || idx >= lastWeek) continue;
|
|
2059
|
+
const weekStart = firstStart.add({ weeks: idx });
|
|
2060
|
+
for (const tok of tokens) {
|
|
2061
|
+
const targetDow = dayMap[tok];
|
|
2062
|
+
const pd = weekStart.add({ days: (targetDow - wkst + 7) % 7 });
|
|
2063
|
+
if (monthsTokens && monthsTokens.length > 0) {
|
|
2064
|
+
if (!monthsTokens.some((t) => this.monthMatchesToken(pd.monthCode, t))) continue;
|
|
2065
|
+
}
|
|
2066
|
+
if (this.opts.byYearDay && this.opts.byYearDay.length > 0) {
|
|
2067
|
+
const lastDay = this.endOfYear(calId, tgtYear).dayOfYear;
|
|
2068
|
+
const matches = this.opts.byYearDay.some((d) => {
|
|
2069
|
+
const target = d > 0 ? d : lastDay + d + 1;
|
|
2070
|
+
return pd.dayOfYear === target;
|
|
2071
|
+
});
|
|
2072
|
+
if (!matches) continue;
|
|
2073
|
+
}
|
|
2074
|
+
occs.push(this.buildZdtFromPlainDate(pd));
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
} else if (this.opts.byYearDay && this.opts.byYearDay.length > 0) {
|
|
2078
|
+
const startOfYear = this.startOfYear(calId, tgtYear);
|
|
2079
|
+
const lastDay = this.endOfYear(calId, tgtYear).dayOfYear;
|
|
2080
|
+
for (const d of this.opts.byYearDay) {
|
|
2081
|
+
const target = d > 0 ? d : lastDay + d + 1;
|
|
2082
|
+
if (target < 1 || target > lastDay) continue;
|
|
2083
|
+
let pd = startOfYear.add({ days: target - 1 });
|
|
2084
|
+
if (monthsTokens && monthsTokens.length > 0) {
|
|
2085
|
+
if (!monthsTokens.some((t) => this.monthMatchesToken(pd.monthCode, t))) continue;
|
|
2086
|
+
}
|
|
2087
|
+
occs.push(this.buildZdtFromPlainDate(pd));
|
|
2088
|
+
}
|
|
2089
|
+
} else if (!monthsTokens || monthsTokens.length === 0) {
|
|
2090
|
+
try {
|
|
2091
|
+
const pd = import_polyfill.Temporal.PlainDate.from({
|
|
2092
|
+
calendar: calId,
|
|
2093
|
+
year: tgtYear,
|
|
2094
|
+
monthCode: seed.monthCode,
|
|
2095
|
+
day: seed.day
|
|
2096
|
+
});
|
|
2097
|
+
occs.push(this.buildZdtFromPlainDate(pd));
|
|
2098
|
+
} catch (e) {
|
|
2099
|
+
const skip = this.opts.skip || "OMIT";
|
|
2100
|
+
if (skip === "FORWARD" || skip === "BACKWARD") {
|
|
2101
|
+
const mapped = seed.with({ year: tgtYear });
|
|
2102
|
+
const adjusted = skip === "BACKWARD" ? mapped.subtract({ days: 1 }) : mapped;
|
|
2103
|
+
occs.push(adjusted.withCalendar("iso8601"));
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
} else {
|
|
2107
|
+
const monthStarts = months.filter((m) => monthsTokens.some((tok) => this.monthMatchesToken(m.monthCode, tok)));
|
|
2108
|
+
for (const ms of monthStarts) {
|
|
2109
|
+
occs.push(...this.generateMonthlyOccurrencesRscale(calId, tgtYear, ms));
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2112
|
+
if (occs.length > 0) {
|
|
2113
|
+
const expanded = occs.flatMap((z) => this.expandByTime(z));
|
|
2114
|
+
const sorted = expanded.sort((a, b) => import_polyfill.Temporal.ZonedDateTime.compare(a, b));
|
|
2115
|
+
const { shouldBreak } = this.processOccurrences(sorted, dates, start, iterator);
|
|
2116
|
+
if (shouldBreak) break;
|
|
2117
|
+
}
|
|
2118
|
+
yearOffset++;
|
|
2119
|
+
if (this.opts.until && tgtYear > this.opts.until.withCalendar(calId).year) break;
|
|
2120
|
+
}
|
|
2121
|
+
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
2122
|
+
}
|
|
2123
|
+
if (this.opts.freq === "WEEKLY") {
|
|
2124
|
+
const dayMap = { MO: 1, TU: 2, WE: 3, TH: 4, FR: 5, SA: 6, SU: 7 };
|
|
2125
|
+
const wkst = dayMap[this.opts.wkst || "MO"];
|
|
2126
|
+
const tokens = ((_c = this.opts.byDay) == null ? void 0 : _c.length) ? this.opts.byDay.map((tok) => {
|
|
2127
|
+
var _a2;
|
|
2128
|
+
return (_a2 = tok.match(/(MO|TU|WE|TH|FR|SA|SU)$/)) == null ? void 0 : _a2[1];
|
|
2129
|
+
}) : [Object.entries(dayMap).find(([, d]) => d === this.originalDtstart.dayOfWeek)[0]];
|
|
2130
|
+
let weekStart = seed.toPlainDate().subtract({ days: (seed.dayOfWeek - wkst + 7) % 7 });
|
|
2131
|
+
while (true) {
|
|
2132
|
+
if (++iterationCount > this.maxIterations) {
|
|
2133
|
+
throw new Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);
|
|
2134
|
+
}
|
|
2135
|
+
const occs = [];
|
|
2136
|
+
for (const tok of tokens) {
|
|
2137
|
+
const targetDow = dayMap[tok];
|
|
2138
|
+
const pd = weekStart.add({ days: (targetDow - wkst + 7) % 7 });
|
|
2139
|
+
if (import_polyfill.Temporal.ZonedDateTime.compare(this.buildZdtFromPlainDate(pd), this.originalDtstart) < 0) {
|
|
2140
|
+
continue;
|
|
2141
|
+
}
|
|
2142
|
+
if (this.opts.byWeekNo && this.opts.byWeekNo.length > 0) {
|
|
2143
|
+
const thursday = weekStart.add({ days: (4 - wkst + 7) % 7 });
|
|
2144
|
+
const weekYear = thursday.year;
|
|
2145
|
+
const firstStart = this.rscaleFirstWeekStart(calId, weekYear, wkst);
|
|
2146
|
+
const lastWeek = this.rscaleLastWeekCount(calId, weekYear, wkst);
|
|
2147
|
+
const idx = Math.floor(pd.since(firstStart).days / 7) + 1;
|
|
2148
|
+
const match = this.opts.byWeekNo.some((wn) => wn > 0 ? idx === wn : idx === lastWeek + wn + 1);
|
|
2149
|
+
if (!match) continue;
|
|
2150
|
+
}
|
|
2151
|
+
if (this.opts.byYearDay && this.opts.byYearDay.length > 0) {
|
|
2152
|
+
const last = this.endOfYear(calId, pd.year).dayOfYear;
|
|
2153
|
+
const match = this.opts.byYearDay.some((d) => d > 0 ? pd.dayOfYear === d : pd.dayOfYear === last + d + 1);
|
|
2154
|
+
if (!match) continue;
|
|
2155
|
+
}
|
|
2156
|
+
const monthsTokens = this.opts.byMonth;
|
|
2157
|
+
if (monthsTokens && monthsTokens.length > 0) {
|
|
2158
|
+
if (!monthsTokens.some((t) => this.monthMatchesToken(pd.monthCode, t))) continue;
|
|
2159
|
+
}
|
|
2160
|
+
occs.push(this.buildZdtFromPlainDate(pd));
|
|
2161
|
+
}
|
|
2162
|
+
if (occs.length) {
|
|
2163
|
+
const expanded = occs.flatMap((z) => this.expandByTime(z));
|
|
2164
|
+
const sorted = expanded.sort((a, b) => import_polyfill.Temporal.ZonedDateTime.compare(a, b));
|
|
2165
|
+
const { shouldBreak } = this.processOccurrences(sorted, dates, start, iterator);
|
|
2166
|
+
if (shouldBreak) return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
2167
|
+
}
|
|
2168
|
+
weekStart = weekStart.add({ weeks: (_d = this.opts.interval) != null ? _d : 1 });
|
|
2169
|
+
if (this.opts.until) {
|
|
2170
|
+
const z = this.buildZdtFromPlainDate(weekStart.add({ days: 6 }));
|
|
2171
|
+
if (import_polyfill.Temporal.ZonedDateTime.compare(z, this.opts.until) > 0) break;
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
2175
|
+
}
|
|
2176
|
+
if (this.opts.freq === "MONTHLY") {
|
|
2177
|
+
let cursor = seed.toPlainDate().with({ day: 1 });
|
|
2178
|
+
while (true) {
|
|
2179
|
+
if (++iterationCount > this.maxIterations) {
|
|
2180
|
+
throw new Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);
|
|
2181
|
+
}
|
|
2182
|
+
const year = cursor.year;
|
|
2183
|
+
const monthStart = cursor;
|
|
2184
|
+
let proceed = true;
|
|
2185
|
+
const monthsTokens = this.opts.byMonth;
|
|
2186
|
+
if (monthsTokens && monthsTokens.length > 0) {
|
|
2187
|
+
proceed = monthsTokens.some((tok) => this.monthMatchesToken(monthStart.monthCode, tok));
|
|
2188
|
+
}
|
|
2189
|
+
if (proceed) {
|
|
2190
|
+
const occs = this.generateMonthlyOccurrencesRscale(calId, year, monthStart);
|
|
2191
|
+
const expanded = occs.flatMap((z) => this.expandByTime(z));
|
|
2192
|
+
const sorted = expanded.sort((a, b) => import_polyfill.Temporal.ZonedDateTime.compare(a, b));
|
|
2193
|
+
const { shouldBreak } = this.processOccurrences(sorted, dates, start, iterator);
|
|
2194
|
+
if (shouldBreak) break;
|
|
2195
|
+
}
|
|
2196
|
+
cursor = cursor.add({ months: (_e = this.opts.interval) != null ? _e : 1 });
|
|
2197
|
+
if (this.opts.until) {
|
|
2198
|
+
const z = this.buildZdtFromPlainDate(cursor);
|
|
2199
|
+
if (import_polyfill.Temporal.ZonedDateTime.compare(z, this.opts.until) > 0) break;
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
2203
|
+
}
|
|
2204
|
+
if (this.opts.freq === "DAILY") {
|
|
2205
|
+
let pd = seed.toPlainDate();
|
|
2206
|
+
while (true) {
|
|
2207
|
+
if (++iterationCount > this.maxIterations) {
|
|
2208
|
+
throw new Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);
|
|
2209
|
+
}
|
|
2210
|
+
if (this.rscaleDateMatches(calId, pd)) {
|
|
2211
|
+
const base = this.buildZdtFromPlainDate(pd);
|
|
2212
|
+
let occs = this.expandByTime(base);
|
|
2213
|
+
occs = this.applyBySetPos(occs);
|
|
2214
|
+
const { shouldBreak } = this.processOccurrences(occs, dates, start, iterator);
|
|
2215
|
+
if (shouldBreak) break;
|
|
2216
|
+
}
|
|
2217
|
+
pd = pd.add({ days: (_f = this.opts.interval) != null ? _f : 1 });
|
|
2218
|
+
if (this.opts.until) {
|
|
2219
|
+
const z = this.buildZdtFromPlainDate(pd);
|
|
2220
|
+
if (import_polyfill.Temporal.ZonedDateTime.compare(z, this.opts.until) > 0) break;
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
2224
|
+
}
|
|
2225
|
+
if (this.opts.freq === "HOURLY" || this.opts.freq === "MINUTELY") {
|
|
2226
|
+
const unit = this.opts.freq === "HOURLY" ? "hour" : "minute";
|
|
2227
|
+
const unitMs = this.opts.freq === "HOURLY" ? 36e5 : 6e4;
|
|
2228
|
+
const interval2 = (_g = this.opts.interval) != null ? _g : 1;
|
|
2229
|
+
let pd = seed.toPlainDate();
|
|
2230
|
+
const startInstantMs = this.originalDtstart.toInstant().epochMilliseconds;
|
|
2231
|
+
while (true) {
|
|
2232
|
+
if (++iterationCount > this.maxIterations) {
|
|
2233
|
+
throw new Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);
|
|
2234
|
+
}
|
|
2235
|
+
if (this.rscaleDateMatches(calId, pd)) {
|
|
2236
|
+
const base = this.buildZdtFromPlainDate(pd);
|
|
2237
|
+
let occs = this.expandByTime(base);
|
|
2238
|
+
occs = occs.filter((occ) => {
|
|
2239
|
+
const delta = occ.toInstant().epochMilliseconds - startInstantMs;
|
|
2240
|
+
const steps = Math.floor(delta / unitMs);
|
|
2241
|
+
return steps % interval2 === 0;
|
|
2242
|
+
});
|
|
2243
|
+
const { shouldBreak } = this.processOccurrences(occs, dates, start, iterator);
|
|
2244
|
+
if (shouldBreak) break;
|
|
2245
|
+
}
|
|
2246
|
+
pd = pd.add({ days: 1 });
|
|
2247
|
+
if (this.opts.until) {
|
|
2248
|
+
const z = this.buildZdtFromPlainDate(pd);
|
|
2249
|
+
if (import_polyfill.Temporal.ZonedDateTime.compare(z, this.opts.until) > 0) break;
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
2253
|
+
}
|
|
2254
|
+
return this._allFallback(iterator);
|
|
2255
|
+
}
|
|
1713
2256
|
};
|
|
1714
2257
|
|
|
1715
2258
|
// src/totext.ts
|
|
@@ -2294,6 +2837,11 @@ function toText(input, locale) {
|
|
|
2294
2837
|
if (exDate && exDate.length) {
|
|
2295
2838
|
parts.push(data.words.excluding, `${exDate.length}`, exDate.length === 1 ? data.words.date : data.words.dates);
|
|
2296
2839
|
}
|
|
2840
|
+
if (opts.rscale) {
|
|
2841
|
+
const rscale = opts.rscale;
|
|
2842
|
+
const skip = opts.skip;
|
|
2843
|
+
parts.push(`(RSCALE=${rscale}${skip ? `;SKIP=${skip}` : ""})`);
|
|
2844
|
+
}
|
|
2297
2845
|
return parts.join(" ");
|
|
2298
2846
|
}
|
|
2299
2847
|
// Annotate the CommonJS export names for ESM import in node:
|