rrule-temporal 1.4.6 → 1.5.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 +38 -0
- package/dist/{chunk-6K5NTVS6.js → chunk-S4JPXM4U.js} +649 -147
- package/dist/index.cjs +654 -149
- package/dist/index.d.cts +39 -2
- package/dist/index.d.ts +39 -2
- package/dist/index.js +9 -3
- package/dist/totext.cjs +657 -162
- package/dist/totext.js +14 -17
- package/package.json +1 -1
|
@@ -32,6 +32,51 @@ var __objRest = (source, exclude) => {
|
|
|
32
32
|
|
|
33
33
|
// src/index.ts
|
|
34
34
|
import { Temporal } from "@js-temporal/polyfill";
|
|
35
|
+
var allowedFreq = ["YEARLY", "MONTHLY", "WEEKLY", "DAILY", "HOURLY", "MINUTELY", "SECONDLY"];
|
|
36
|
+
var allowedWeekdays = ["MO", "TU", "WE", "TH", "FR", "SA", "SU"];
|
|
37
|
+
var weekdayToIsoDay = {
|
|
38
|
+
MO: 1,
|
|
39
|
+
TU: 2,
|
|
40
|
+
WE: 3,
|
|
41
|
+
TH: 4,
|
|
42
|
+
FR: 5,
|
|
43
|
+
SA: 6,
|
|
44
|
+
SU: 7
|
|
45
|
+
};
|
|
46
|
+
var allowedFreqSet = new Set(allowedFreq);
|
|
47
|
+
var allowedWeekdaysSet = new Set(allowedWeekdays);
|
|
48
|
+
var byDayTokenRegex = new RegExp(`^([+-]?\\d{1,2})?(${allowedWeekdays.join("|")})$`);
|
|
49
|
+
var byDayWeekdaySuffixRegex = new RegExp(`(${allowedWeekdays.join("|")})$`);
|
|
50
|
+
var MS_PER_SECOND = 1e3;
|
|
51
|
+
var MS_PER_MINUTE = 60 * MS_PER_SECOND;
|
|
52
|
+
var MS_PER_HOUR = 60 * MS_PER_MINUTE;
|
|
53
|
+
var MS_PER_DAY = 24 * MS_PER_HOUR;
|
|
54
|
+
var MS_PER_WEEK = 7 * MS_PER_DAY;
|
|
55
|
+
var GREGORIAN_MONTH_LENGTHS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
56
|
+
var GREGORIAN_WEEKDAY_OFFSETS = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4];
|
|
57
|
+
var NS_PER_MILLISECOND = BigInt(1e6);
|
|
58
|
+
var NS_PER_SECOND = BigInt(1e9);
|
|
59
|
+
var NS_PER_MINUTE = BigInt(60) * NS_PER_SECOND;
|
|
60
|
+
var NS_PER_HOUR = BigInt(60) * NS_PER_MINUTE;
|
|
61
|
+
var NS_PER_DAY = BigInt(24) * NS_PER_HOUR;
|
|
62
|
+
var NS_PER_WEEK = BigInt(7) * NS_PER_DAY;
|
|
63
|
+
function addIsoDays(dayOfWeek, deltaDays) {
|
|
64
|
+
return (dayOfWeek - 1 + deltaDays % 7 + 7) % 7 + 1;
|
|
65
|
+
}
|
|
66
|
+
function extractWeekdayToken(token) {
|
|
67
|
+
const m = token.toUpperCase().match(byDayWeekdaySuffixRegex);
|
|
68
|
+
const weekday = m == null ? void 0 : m[1];
|
|
69
|
+
if (!weekday || !allowedWeekdaysSet.has(weekday)) return null;
|
|
70
|
+
return weekday;
|
|
71
|
+
}
|
|
72
|
+
function parseByDayToken(token) {
|
|
73
|
+
const m = token.toUpperCase().match(byDayTokenRegex);
|
|
74
|
+
if (!m) return null;
|
|
75
|
+
const ord = m[1] ? parseInt(m[1], 10) : 0;
|
|
76
|
+
const weekday = m[2];
|
|
77
|
+
if (!weekday || !allowedWeekdaysSet.has(weekday)) return null;
|
|
78
|
+
return { ord, weekday };
|
|
79
|
+
}
|
|
35
80
|
function isIcsOpts(opts) {
|
|
36
81
|
return typeof opts.rruleString === "string";
|
|
37
82
|
}
|
|
@@ -205,7 +250,7 @@ function parseRRuleString(input, targetTimezone, dtstart, strict = false) {
|
|
|
205
250
|
opts.bySecond = parseNumberArray(val, true);
|
|
206
251
|
break;
|
|
207
252
|
case "BYDAY":
|
|
208
|
-
opts.byDay = val.split(",");
|
|
253
|
+
opts.byDay = val.split(",").map((token) => token.toUpperCase());
|
|
209
254
|
break;
|
|
210
255
|
case "BYMONTH":
|
|
211
256
|
opts.byMonth = parseByMonthArray(val);
|
|
@@ -223,7 +268,7 @@ function parseRRuleString(input, targetTimezone, dtstart, strict = false) {
|
|
|
223
268
|
opts.bySetPos = parseNumberArray(val);
|
|
224
269
|
break;
|
|
225
270
|
case "WKST":
|
|
226
|
-
opts.wkst = val;
|
|
271
|
+
opts.wkst = val == null ? void 0 : val.toUpperCase();
|
|
227
272
|
break;
|
|
228
273
|
}
|
|
229
274
|
}
|
|
@@ -244,7 +289,7 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
244
289
|
return Temporal.ZonedDateTime.from(zdt.toString());
|
|
245
290
|
}
|
|
246
291
|
constructor(params) {
|
|
247
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
292
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
248
293
|
let manual;
|
|
249
294
|
if (isIcsOpts(params)) {
|
|
250
295
|
const parsed = parseRRuleString(params.rruleString, params.tzid, params.dtstart, (_a = params.strict) != null ? _a : false);
|
|
@@ -285,6 +330,32 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
285
330
|
this.opts = this.sanitizeOpts(manual);
|
|
286
331
|
this.maxIterations = (_g = manual.maxIterations) != null ? _g : 1e4;
|
|
287
332
|
this.includeDtstart = (_h = manual.includeDtstart) != null ? _h : false;
|
|
333
|
+
this.parsedByDayTokens = this.buildParsedByDayTokens(this.opts.byDay);
|
|
334
|
+
this.simpleByDayIsoDays = this.buildByDayIsoDays(this.parsedByDayTokens, false);
|
|
335
|
+
this.allByDayIsoDays = this.buildByDayIsoDays(this.parsedByDayTokens, true);
|
|
336
|
+
this.hasOrdinalByDay = (_j = (_i = this.parsedByDayTokens) == null ? void 0 : _i.some((token) => token.ord !== 0)) != null ? _j : false;
|
|
337
|
+
this.canUseEpochMillisecondsPrecisionFlag = this.originalDtstart.microsecond === 0 && this.originalDtstart.nanosecond === 0 && (!this.opts.until || this.opts.until.microsecond === 0 && this.opts.until.nanosecond === 0);
|
|
338
|
+
this.timeSlotOffsetsMs = this.buildTimeSlotOffsetsMs();
|
|
339
|
+
this.numericByMonths = (_k = this.opts.byMonth) == null ? void 0 : _k.filter((value) => typeof value === "number");
|
|
340
|
+
}
|
|
341
|
+
buildParsedByDayTokens(byDay) {
|
|
342
|
+
if (!(byDay == null ? void 0 : byDay.length)) return void 0;
|
|
343
|
+
const tokens = byDay.map((tok) => {
|
|
344
|
+
const parsed = parseByDayToken(tok);
|
|
345
|
+
if (!parsed) return null;
|
|
346
|
+
return {
|
|
347
|
+
ord: parsed.ord,
|
|
348
|
+
weekday: parsed.weekday,
|
|
349
|
+
isoDay: weekdayToIsoDay[parsed.weekday]
|
|
350
|
+
};
|
|
351
|
+
}).filter((token) => token !== null);
|
|
352
|
+
return tokens.length > 0 ? tokens : void 0;
|
|
353
|
+
}
|
|
354
|
+
buildByDayIsoDays(tokens, includeOrdinals) {
|
|
355
|
+
if (!(tokens == null ? void 0 : tokens.length)) return void 0;
|
|
356
|
+
const isoDays = tokens.filter((token) => includeOrdinals || token.ord === 0).map((token) => token.isoDay);
|
|
357
|
+
if (!isoDays.length) return void 0;
|
|
358
|
+
return [...new Set(isoDays)].sort((a, b) => a - b);
|
|
288
359
|
}
|
|
289
360
|
sanitizeNumericArray(arr, min, max, allowZero = false, sort = false) {
|
|
290
361
|
if (!arr) return void 0;
|
|
@@ -293,22 +364,20 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
293
364
|
return sort ? sanitized.sort((a, b) => a - b) : sanitized;
|
|
294
365
|
}
|
|
295
366
|
sanitizeByDay(byDay) {
|
|
296
|
-
const
|
|
297
|
-
const
|
|
367
|
+
const days = (byDay != null ? byDay : []).filter((day) => Boolean(day) && typeof day === "string");
|
|
368
|
+
const normalized = [];
|
|
298
369
|
for (const day of days) {
|
|
299
|
-
const
|
|
300
|
-
|
|
370
|
+
const token = day.toUpperCase();
|
|
371
|
+
const parsed = parseByDayToken(token);
|
|
372
|
+
if (!parsed) {
|
|
301
373
|
throw new Error(`Invalid BYDAY value: ${day}`);
|
|
302
374
|
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
const ordInt = parseInt(ord, 10);
|
|
306
|
-
if (ordInt === 0) {
|
|
307
|
-
throw new Error(`Invalid BYDAY value: ${day}`);
|
|
308
|
-
}
|
|
375
|
+
if (parsed.ord === 0 && /^[+-]?\d/.test(token)) {
|
|
376
|
+
throw new Error(`Invalid BYDAY value: ${day}`);
|
|
309
377
|
}
|
|
378
|
+
normalized.push(token);
|
|
310
379
|
}
|
|
311
|
-
return
|
|
380
|
+
return normalized.length > 0 ? normalized : void 0;
|
|
312
381
|
}
|
|
313
382
|
enforceStrictRfc(opts) {
|
|
314
383
|
var _a;
|
|
@@ -339,7 +408,17 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
339
408
|
}
|
|
340
409
|
sanitizeOpts(opts) {
|
|
341
410
|
var _a;
|
|
411
|
+
if (!allowedFreqSet.has(opts.freq)) {
|
|
412
|
+
throw new Error(`Invalid FREQ value: ${opts.freq}`);
|
|
413
|
+
}
|
|
342
414
|
opts.byDay = this.sanitizeByDay(opts.byDay);
|
|
415
|
+
if (opts.wkst) {
|
|
416
|
+
const wkst = opts.wkst.toUpperCase();
|
|
417
|
+
if (!allowedWeekdaysSet.has(wkst)) {
|
|
418
|
+
throw new Error(`Invalid WKST value: ${opts.wkst}`);
|
|
419
|
+
}
|
|
420
|
+
opts.wkst = wkst;
|
|
421
|
+
}
|
|
343
422
|
if (opts.byMonth) {
|
|
344
423
|
const numeric = opts.byMonth.filter((v) => typeof v === "number");
|
|
345
424
|
const stringy = opts.byMonth.filter((v) => typeof v === "string");
|
|
@@ -398,9 +477,21 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
398
477
|
*/
|
|
399
478
|
expandByTime(base) {
|
|
400
479
|
var _a, _b, _c;
|
|
480
|
+
if (!this.opts.byHour && !this.opts.byMinute && !this.opts.bySecond) {
|
|
481
|
+
return [base];
|
|
482
|
+
}
|
|
401
483
|
const hours = (_a = this.opts.byHour) != null ? _a : [base.hour];
|
|
402
484
|
const minutes = (_b = this.opts.byMinute) != null ? _b : [base.minute];
|
|
403
485
|
const seconds = (_c = this.opts.bySecond) != null ? _c : [base.second];
|
|
486
|
+
if (hours.length === 1 && minutes.length === 1 && seconds.length === 1) {
|
|
487
|
+
const hour = hours[0];
|
|
488
|
+
const minute = minutes[0];
|
|
489
|
+
const second = seconds[0];
|
|
490
|
+
if (hour === base.hour && minute === base.minute && second === base.second) {
|
|
491
|
+
return [base];
|
|
492
|
+
}
|
|
493
|
+
return [base.with({ hour, minute, second })];
|
|
494
|
+
}
|
|
404
495
|
const out = [];
|
|
405
496
|
for (const h of hours) {
|
|
406
497
|
for (const m of minutes) {
|
|
@@ -554,11 +645,8 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
554
645
|
weekStart = firstThursday.subtract({ days: 3 }).add({ weeks: lastWeek + targetWeek });
|
|
555
646
|
}
|
|
556
647
|
if ((_b = this.opts.byDay) == null ? void 0 : _b.length) {
|
|
557
|
-
const dayMap =
|
|
558
|
-
const targetDays = this.opts.byDay.map((tok) =>
|
|
559
|
-
var _a2;
|
|
560
|
-
return (_a2 = tok.match(/(MO|TU|WE|TH|FR|SA|SU)$/)) == null ? void 0 : _a2[1];
|
|
561
|
-
}).filter(Boolean).map((day) => dayMap[day]).filter(Boolean);
|
|
648
|
+
const dayMap = weekdayToIsoDay;
|
|
649
|
+
const targetDays = this.opts.byDay.map((tok) => extractWeekdayToken(tok)).filter((day) => day !== null).map((day) => dayMap[day]).filter(Boolean);
|
|
562
650
|
if (targetDays.length) {
|
|
563
651
|
const candidates = targetDays.map((dayOfWeek) => {
|
|
564
652
|
const delta = (dayOfWeek - weekStart.dayOfWeek + 7) % 7;
|
|
@@ -581,7 +669,7 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
581
669
|
}
|
|
582
670
|
}
|
|
583
671
|
if (((_c = this.opts.byDay) == null ? void 0 : _c.length) && !this.opts.byWeekNo) {
|
|
584
|
-
const dayMap =
|
|
672
|
+
const dayMap = weekdayToIsoDay;
|
|
585
673
|
const hasOrdinalTokens = this.opts.byDay.some((tok) => /^[+-]?\d/.test(tok));
|
|
586
674
|
if (hasOrdinalTokens && this.opts.byMonth && (this.opts.freq === "MINUTELY" || this.opts.freq === "SECONDLY")) {
|
|
587
675
|
const months = this.opts.byMonth.filter((v) => typeof v === "number").sort((a, b) => a - b);
|
|
@@ -607,14 +695,11 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
607
695
|
}
|
|
608
696
|
} else {
|
|
609
697
|
let deltas;
|
|
610
|
-
|
|
611
|
-
|
|
698
|
+
const weekdayTokens = this.opts.byDay.map((tok) => extractWeekdayToken(tok)).filter((tok) => tok !== null);
|
|
699
|
+
if (["DAILY", "HOURLY", "MINUTELY", "SECONDLY"].includes(this.opts.freq) && weekdayTokens.length === this.opts.byDay.length) {
|
|
700
|
+
deltas = weekdayTokens.map((tok) => (dayMap[tok] - zdt.dayOfWeek + 7) % 7);
|
|
612
701
|
} else {
|
|
613
|
-
deltas =
|
|
614
|
-
var _a2;
|
|
615
|
-
const wdTok = (_a2 = tok.match(/(MO|TU|WE|TH|FR|SA|SU)$/)) == null ? void 0 : _a2[1];
|
|
616
|
-
return wdTok ? (dayMap[wdTok] - zdt.dayOfWeek + 7) % 7 : null;
|
|
617
|
-
}).filter((d) => d !== null);
|
|
702
|
+
deltas = weekdayTokens.map((wdTok) => (dayMap[wdTok] - zdt.dayOfWeek + 7) % 7);
|
|
618
703
|
}
|
|
619
704
|
if (deltas.length) {
|
|
620
705
|
zdt = zdt.add({ days: Math.min(...deltas) });
|
|
@@ -654,32 +739,26 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
654
739
|
// --- NEW: constraint checks ---
|
|
655
740
|
// 2) Replace your matchesByDay with this:
|
|
656
741
|
matchesByDay(zdt) {
|
|
742
|
+
var _a, _b, _c;
|
|
657
743
|
const { byDay, freq } = this.opts;
|
|
658
744
|
if (!byDay) return true;
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
const wd = dayMap[weekday];
|
|
667
|
-
if (freq === "DAILY") {
|
|
668
|
-
if (zdt.dayOfWeek === wd) return true;
|
|
669
|
-
continue;
|
|
670
|
-
}
|
|
671
|
-
if (ord === 0) {
|
|
672
|
-
if (zdt.dayOfWeek === wd) return true;
|
|
745
|
+
if (!this.hasOrdinalByDay) {
|
|
746
|
+
return (_b = (_a = this.simpleByDayIsoDays) == null ? void 0 : _a.includes(zdt.dayOfWeek)) != null ? _b : false;
|
|
747
|
+
}
|
|
748
|
+
for (const token of (_c = this.parsedByDayTokens) != null ? _c : []) {
|
|
749
|
+
if (freq === "DAILY" && zdt.dayOfWeek === token.isoDay) return true;
|
|
750
|
+
if (token.ord === 0) {
|
|
751
|
+
if (zdt.dayOfWeek === token.isoDay) return true;
|
|
673
752
|
continue;
|
|
674
753
|
}
|
|
675
754
|
const month = zdt.month;
|
|
676
755
|
let dt = zdt.with({ day: 1 });
|
|
677
756
|
const candidates = [];
|
|
678
757
|
while (dt.month === month) {
|
|
679
|
-
if (dt.dayOfWeek ===
|
|
758
|
+
if (dt.dayOfWeek === token.isoDay) candidates.push(dt.day);
|
|
680
759
|
dt = dt.add({ days: 1 });
|
|
681
760
|
}
|
|
682
|
-
const idx = ord > 0 ? ord - 1 : candidates.length + ord;
|
|
761
|
+
const idx = token.ord > 0 ? token.ord - 1 : candidates.length + token.ord;
|
|
683
762
|
if (candidates[idx] === zdt.day) return true;
|
|
684
763
|
}
|
|
685
764
|
return false;
|
|
@@ -872,6 +951,485 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
872
951
|
}
|
|
873
952
|
return true;
|
|
874
953
|
}
|
|
954
|
+
canUseUtcLinearFastPath(iterator) {
|
|
955
|
+
if (iterator || this.tzid !== "UTC" || this.opts.rscale || this.opts.rDate || this.opts.exDate) {
|
|
956
|
+
return false;
|
|
957
|
+
}
|
|
958
|
+
if (this.opts.byMonth || this.opts.byMonthDay || this.opts.byYearDay || this.opts.byWeekNo || this.opts.bySetPos) {
|
|
959
|
+
return false;
|
|
960
|
+
}
|
|
961
|
+
switch (this.opts.freq) {
|
|
962
|
+
case "DAILY":
|
|
963
|
+
return !this.opts.byHour && !this.opts.byMinute && !this.opts.bySecond && !this.hasOrdinalByDay;
|
|
964
|
+
case "HOURLY":
|
|
965
|
+
case "MINUTELY":
|
|
966
|
+
return !this.opts.byDay && !this.opts.byHour && !this.opts.byMinute && !this.opts.bySecond;
|
|
967
|
+
default:
|
|
968
|
+
return false;
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
canUseUtcWeeklyFastPath(iterator) {
|
|
972
|
+
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.opts.byMinute && !this.opts.bySecond && !this.hasOrdinalByDay;
|
|
973
|
+
}
|
|
974
|
+
canUseUtcMonthlyFastPath(iterator) {
|
|
975
|
+
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);
|
|
976
|
+
}
|
|
977
|
+
utcZdtFromEpochNanoseconds(epochNanoseconds) {
|
|
978
|
+
return Temporal.Instant.fromEpochNanoseconds(epochNanoseconds).toZonedDateTimeISO("UTC");
|
|
979
|
+
}
|
|
980
|
+
utcZdtFromEpochMilliseconds(epochMilliseconds) {
|
|
981
|
+
return Temporal.Instant.fromEpochMilliseconds(epochMilliseconds).toZonedDateTimeISO("UTC");
|
|
982
|
+
}
|
|
983
|
+
canUseUtcEpochMillisecondsPrecision() {
|
|
984
|
+
return this.canUseEpochMillisecondsPrecisionFlag;
|
|
985
|
+
}
|
|
986
|
+
buildTimeSlotOffsetsMs() {
|
|
987
|
+
var _a, _b, _c;
|
|
988
|
+
if (!this.canUseEpochMillisecondsPrecisionFlag) return void 0;
|
|
989
|
+
const hours = (_a = this.opts.byHour) != null ? _a : [this.originalDtstart.hour];
|
|
990
|
+
const minutes = (_b = this.opts.byMinute) != null ? _b : [this.originalDtstart.minute];
|
|
991
|
+
const seconds = (_c = this.opts.bySecond) != null ? _c : [this.originalDtstart.second];
|
|
992
|
+
const baseMilliseconds = this.originalDtstart.millisecond;
|
|
993
|
+
const offsets = [];
|
|
994
|
+
for (const hour of hours) {
|
|
995
|
+
for (const minute of minutes) {
|
|
996
|
+
for (const second of seconds) {
|
|
997
|
+
offsets.push(((hour * 60 + minute) * 60 + second) * MS_PER_SECOND + baseMilliseconds);
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
return offsets;
|
|
1002
|
+
}
|
|
1003
|
+
findFirstMatchingDailyStep(startDayOfWeek, stepDays, allowedDays) {
|
|
1004
|
+
let dayOfWeek = startDayOfWeek;
|
|
1005
|
+
for (let steps = 0; steps < 7; steps++) {
|
|
1006
|
+
if (allowedDays.includes(dayOfWeek)) {
|
|
1007
|
+
return steps;
|
|
1008
|
+
}
|
|
1009
|
+
dayOfWeek = addIsoDays(dayOfWeek, stepDays);
|
|
1010
|
+
}
|
|
1011
|
+
return null;
|
|
1012
|
+
}
|
|
1013
|
+
allUtcFastPath(iterator) {
|
|
1014
|
+
if (this.canUseUtcLinearFastPath(iterator)) {
|
|
1015
|
+
switch (this.opts.freq) {
|
|
1016
|
+
case "DAILY":
|
|
1017
|
+
return this._allUtcDailySimple();
|
|
1018
|
+
case "HOURLY":
|
|
1019
|
+
return this._allUtcFixedStepSimple(NS_PER_HOUR * BigInt(this.opts.interval));
|
|
1020
|
+
case "MINUTELY":
|
|
1021
|
+
return this._allUtcFixedStepSimple(NS_PER_MINUTE * BigInt(this.opts.interval));
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
if (this.canUseUtcMonthlyFastPath(iterator)) {
|
|
1025
|
+
return this._allUtcMonthlyByDayOrMonthDay();
|
|
1026
|
+
}
|
|
1027
|
+
if (this.canUseUtcWeeklyFastPath(iterator)) {
|
|
1028
|
+
return this._allUtcWeeklySimple();
|
|
1029
|
+
}
|
|
1030
|
+
return null;
|
|
1031
|
+
}
|
|
1032
|
+
_allUtcFixedStepSimple(stepNanoseconds) {
|
|
1033
|
+
var _a, _b;
|
|
1034
|
+
const dates = [];
|
|
1035
|
+
if (!this.addDtstartIfNeeded(dates)) {
|
|
1036
|
+
return dates;
|
|
1037
|
+
}
|
|
1038
|
+
let iterationCount = 0;
|
|
1039
|
+
if (this.canUseUtcEpochMillisecondsPrecision()) {
|
|
1040
|
+
let currentMilliseconds = this.originalDtstart.epochMilliseconds;
|
|
1041
|
+
const stepMilliseconds = Number(stepNanoseconds / NS_PER_MILLISECOND);
|
|
1042
|
+
const untilMilliseconds = (_a = this.opts.until) == null ? void 0 : _a.epochMilliseconds;
|
|
1043
|
+
while (true) {
|
|
1044
|
+
if (++iterationCount > this.maxIterations) {
|
|
1045
|
+
throw new Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);
|
|
1046
|
+
}
|
|
1047
|
+
if (untilMilliseconds !== void 0 && currentMilliseconds > untilMilliseconds) {
|
|
1048
|
+
break;
|
|
1049
|
+
}
|
|
1050
|
+
dates.push(this.utcZdtFromEpochMilliseconds(currentMilliseconds));
|
|
1051
|
+
if (this.shouldBreakForCountLimit(dates.length)) {
|
|
1052
|
+
break;
|
|
1053
|
+
}
|
|
1054
|
+
currentMilliseconds += stepMilliseconds;
|
|
1055
|
+
}
|
|
1056
|
+
return dates;
|
|
1057
|
+
}
|
|
1058
|
+
let currentNanoseconds = this.originalDtstart.epochNanoseconds;
|
|
1059
|
+
const untilNanoseconds = (_b = this.opts.until) == null ? void 0 : _b.epochNanoseconds;
|
|
1060
|
+
while (true) {
|
|
1061
|
+
if (++iterationCount > this.maxIterations) {
|
|
1062
|
+
throw new Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);
|
|
1063
|
+
}
|
|
1064
|
+
if (untilNanoseconds !== void 0 && currentNanoseconds > untilNanoseconds) {
|
|
1065
|
+
break;
|
|
1066
|
+
}
|
|
1067
|
+
dates.push(this.utcZdtFromEpochNanoseconds(currentNanoseconds));
|
|
1068
|
+
if (this.shouldBreakForCountLimit(dates.length)) {
|
|
1069
|
+
break;
|
|
1070
|
+
}
|
|
1071
|
+
currentNanoseconds += stepNanoseconds;
|
|
1072
|
+
}
|
|
1073
|
+
return dates;
|
|
1074
|
+
}
|
|
1075
|
+
_allUtcDailySimple() {
|
|
1076
|
+
var _a, _b;
|
|
1077
|
+
const dates = [];
|
|
1078
|
+
if (!this.addDtstartIfNeeded(dates)) {
|
|
1079
|
+
return dates;
|
|
1080
|
+
}
|
|
1081
|
+
const stepDays = this.opts.interval;
|
|
1082
|
+
const allowedDays = this.simpleByDayIsoDays;
|
|
1083
|
+
let iterationCount = 0;
|
|
1084
|
+
if (this.canUseUtcEpochMillisecondsPrecision()) {
|
|
1085
|
+
const stepMilliseconds = stepDays * MS_PER_DAY;
|
|
1086
|
+
const untilMilliseconds = (_a = this.opts.until) == null ? void 0 : _a.epochMilliseconds;
|
|
1087
|
+
let currentMilliseconds = this.originalDtstart.epochMilliseconds;
|
|
1088
|
+
let currentDayOfWeek2 = this.originalDtstart.dayOfWeek;
|
|
1089
|
+
if (allowedDays == null ? void 0 : allowedDays.length) {
|
|
1090
|
+
const firstMatchingStep = this.findFirstMatchingDailyStep(currentDayOfWeek2, stepDays, allowedDays);
|
|
1091
|
+
if (firstMatchingStep === null) {
|
|
1092
|
+
return dates;
|
|
1093
|
+
}
|
|
1094
|
+
currentMilliseconds += firstMatchingStep * stepMilliseconds;
|
|
1095
|
+
currentDayOfWeek2 = addIsoDays(currentDayOfWeek2, firstMatchingStep * stepDays);
|
|
1096
|
+
}
|
|
1097
|
+
while (true) {
|
|
1098
|
+
if (++iterationCount > this.maxIterations) {
|
|
1099
|
+
throw new Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);
|
|
1100
|
+
}
|
|
1101
|
+
if (untilMilliseconds !== void 0 && currentMilliseconds > untilMilliseconds) {
|
|
1102
|
+
break;
|
|
1103
|
+
}
|
|
1104
|
+
if (!allowedDays || allowedDays.includes(currentDayOfWeek2)) {
|
|
1105
|
+
dates.push(this.utcZdtFromEpochMilliseconds(currentMilliseconds));
|
|
1106
|
+
if (this.shouldBreakForCountLimit(dates.length)) {
|
|
1107
|
+
break;
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
currentMilliseconds += stepMilliseconds;
|
|
1111
|
+
currentDayOfWeek2 = addIsoDays(currentDayOfWeek2, stepDays);
|
|
1112
|
+
}
|
|
1113
|
+
return dates;
|
|
1114
|
+
}
|
|
1115
|
+
const stepNanoseconds = BigInt(stepDays) * NS_PER_DAY;
|
|
1116
|
+
const untilNanoseconds = (_b = this.opts.until) == null ? void 0 : _b.epochNanoseconds;
|
|
1117
|
+
let currentNanoseconds = this.originalDtstart.epochNanoseconds;
|
|
1118
|
+
let currentDayOfWeek = this.originalDtstart.dayOfWeek;
|
|
1119
|
+
if (allowedDays == null ? void 0 : allowedDays.length) {
|
|
1120
|
+
const firstMatchingStep = this.findFirstMatchingDailyStep(currentDayOfWeek, stepDays, allowedDays);
|
|
1121
|
+
if (firstMatchingStep === null) {
|
|
1122
|
+
return dates;
|
|
1123
|
+
}
|
|
1124
|
+
currentNanoseconds += BigInt(firstMatchingStep) * stepNanoseconds;
|
|
1125
|
+
currentDayOfWeek = addIsoDays(currentDayOfWeek, firstMatchingStep * stepDays);
|
|
1126
|
+
}
|
|
1127
|
+
while (true) {
|
|
1128
|
+
if (++iterationCount > this.maxIterations) {
|
|
1129
|
+
throw new Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);
|
|
1130
|
+
}
|
|
1131
|
+
if (untilNanoseconds !== void 0 && currentNanoseconds > untilNanoseconds) {
|
|
1132
|
+
break;
|
|
1133
|
+
}
|
|
1134
|
+
if (!allowedDays || allowedDays.includes(currentDayOfWeek)) {
|
|
1135
|
+
dates.push(this.utcZdtFromEpochNanoseconds(currentNanoseconds));
|
|
1136
|
+
if (this.shouldBreakForCountLimit(dates.length)) {
|
|
1137
|
+
break;
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
currentNanoseconds += stepNanoseconds;
|
|
1141
|
+
currentDayOfWeek = addIsoDays(currentDayOfWeek, stepDays);
|
|
1142
|
+
}
|
|
1143
|
+
return dates;
|
|
1144
|
+
}
|
|
1145
|
+
_allUtcWeeklySimple() {
|
|
1146
|
+
var _a, _b, _c, _d, _e;
|
|
1147
|
+
const dates = [];
|
|
1148
|
+
if (!this.addDtstartIfNeeded(dates)) {
|
|
1149
|
+
return dates;
|
|
1150
|
+
}
|
|
1151
|
+
const start = this.originalDtstart;
|
|
1152
|
+
const wkstToken = (_a = extractWeekdayToken(this.opts.wkst || "MO")) != null ? _a : "MO";
|
|
1153
|
+
const wkstDay = (_b = weekdayToIsoDay[wkstToken]) != null ? _b : 1;
|
|
1154
|
+
const targetDays = this.opts.byDay ? [...(_c = this.allByDayIsoDays) != null ? _c : []] : [start.dayOfWeek];
|
|
1155
|
+
const dayOffsets = targetDays.map((day) => (day - wkstDay + 7) % 7).sort((a, b) => a - b);
|
|
1156
|
+
const weekStartOffset = (start.dayOfWeek - wkstDay + 7) % 7;
|
|
1157
|
+
let iterationCount = 0;
|
|
1158
|
+
if (this.canUseUtcEpochMillisecondsPrecision()) {
|
|
1159
|
+
const startMilliseconds = start.epochMilliseconds;
|
|
1160
|
+
const untilMilliseconds = (_d = this.opts.until) == null ? void 0 : _d.epochMilliseconds;
|
|
1161
|
+
const weekStepMilliseconds = this.opts.interval * MS_PER_WEEK;
|
|
1162
|
+
let weekStartMilliseconds = startMilliseconds - weekStartOffset * MS_PER_DAY;
|
|
1163
|
+
while (true) {
|
|
1164
|
+
if (++iterationCount > this.maxIterations) {
|
|
1165
|
+
throw new Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);
|
|
1166
|
+
}
|
|
1167
|
+
for (const dayOffset of dayOffsets) {
|
|
1168
|
+
const occurrenceMilliseconds = weekStartMilliseconds + dayOffset * MS_PER_DAY;
|
|
1169
|
+
if (occurrenceMilliseconds < startMilliseconds) {
|
|
1170
|
+
continue;
|
|
1171
|
+
}
|
|
1172
|
+
if (untilMilliseconds !== void 0 && occurrenceMilliseconds > untilMilliseconds) {
|
|
1173
|
+
return dates;
|
|
1174
|
+
}
|
|
1175
|
+
dates.push(this.utcZdtFromEpochMilliseconds(occurrenceMilliseconds));
|
|
1176
|
+
if (this.shouldBreakForCountLimit(dates.length)) {
|
|
1177
|
+
return dates;
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
weekStartMilliseconds += weekStepMilliseconds;
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
const startNanoseconds = start.epochNanoseconds;
|
|
1184
|
+
const untilNanoseconds = (_e = this.opts.until) == null ? void 0 : _e.epochNanoseconds;
|
|
1185
|
+
const weekStepNanoseconds = BigInt(this.opts.interval) * NS_PER_WEEK;
|
|
1186
|
+
let weekStartNanoseconds = startNanoseconds - BigInt(weekStartOffset) * NS_PER_DAY;
|
|
1187
|
+
while (true) {
|
|
1188
|
+
if (++iterationCount > this.maxIterations) {
|
|
1189
|
+
throw new Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);
|
|
1190
|
+
}
|
|
1191
|
+
for (const dayOffset of dayOffsets) {
|
|
1192
|
+
const occurrenceNanoseconds = weekStartNanoseconds + BigInt(dayOffset) * NS_PER_DAY;
|
|
1193
|
+
if (occurrenceNanoseconds < startNanoseconds) {
|
|
1194
|
+
continue;
|
|
1195
|
+
}
|
|
1196
|
+
if (untilNanoseconds !== void 0 && occurrenceNanoseconds > untilNanoseconds) {
|
|
1197
|
+
return dates;
|
|
1198
|
+
}
|
|
1199
|
+
dates.push(this.utcZdtFromEpochNanoseconds(occurrenceNanoseconds));
|
|
1200
|
+
if (this.shouldBreakForCountLimit(dates.length)) {
|
|
1201
|
+
return dates;
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
weekStartNanoseconds += weekStepNanoseconds;
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
hasSingleExpandedTimeSlot() {
|
|
1208
|
+
var _a, _b, _c;
|
|
1209
|
+
if (this.timeSlotOffsetsMs) {
|
|
1210
|
+
return this.timeSlotOffsetsMs.length === 1;
|
|
1211
|
+
}
|
|
1212
|
+
const hours = (_a = this.opts.byHour) != null ? _a : [this.originalDtstart.hour];
|
|
1213
|
+
const minutes = (_b = this.opts.byMinute) != null ? _b : [this.originalDtstart.minute];
|
|
1214
|
+
const seconds = (_c = this.opts.bySecond) != null ? _c : [this.originalDtstart.second];
|
|
1215
|
+
return hours.length === 1 && minutes.length === 1 && seconds.length === 1;
|
|
1216
|
+
}
|
|
1217
|
+
buildMonthlyOccurrenceOnDay(monthStart, day) {
|
|
1218
|
+
const base = monthStart.day === day ? monthStart : monthStart.with({ day });
|
|
1219
|
+
return this.applyTimeOverride(base);
|
|
1220
|
+
}
|
|
1221
|
+
applyBySetPosToSortedList(list) {
|
|
1222
|
+
const { bySetPos } = this.opts;
|
|
1223
|
+
if (!bySetPos || !bySetPos.length || list.length === 0) return list;
|
|
1224
|
+
const out = [];
|
|
1225
|
+
const len = list.length;
|
|
1226
|
+
for (const pos of bySetPos) {
|
|
1227
|
+
const idx = pos > 0 ? pos - 1 : len + pos;
|
|
1228
|
+
if (idx >= 0 && idx < len) out.push(list[idx]);
|
|
1229
|
+
}
|
|
1230
|
+
return out;
|
|
1231
|
+
}
|
|
1232
|
+
generateMonthlyOccurrenceDays(sample) {
|
|
1233
|
+
const { byDay, byMonth, byMonthDay } = this.opts;
|
|
1234
|
+
const monthStart = sample.day === 1 ? sample : sample.with({ day: 1 });
|
|
1235
|
+
if (byMonth && !byMonth.includes(sample.month)) return [];
|
|
1236
|
+
const lastDay = monthStart.add({ months: 1 }).subtract({ days: 1 }).day;
|
|
1237
|
+
let byMonthDayHits = [];
|
|
1238
|
+
if (byMonthDay && byMonthDay.length > 0) {
|
|
1239
|
+
byMonthDayHits = byMonthDay.map((d) => d > 0 ? d : lastDay + d + 1).filter((d) => d >= 1 && d <= lastDay);
|
|
1240
|
+
byMonthDayHits = [...new Set(byMonthDayHits)].sort((a, b) => a - b);
|
|
1241
|
+
}
|
|
1242
|
+
if (!byDay && byMonthDay && byMonthDay.length > 0) {
|
|
1243
|
+
return byMonthDayHits;
|
|
1244
|
+
}
|
|
1245
|
+
if (!byDay) {
|
|
1246
|
+
return [sample.day];
|
|
1247
|
+
}
|
|
1248
|
+
const tokens = this.parsedByDayTokens;
|
|
1249
|
+
if (!(tokens == null ? void 0 : tokens.length)) return [];
|
|
1250
|
+
const firstDayOfWeek = monthStart.dayOfWeek;
|
|
1251
|
+
const lastDayOfWeek = (firstDayOfWeek - 1 + lastDay - 1) % 7 + 1;
|
|
1252
|
+
const byDayHits = /* @__PURE__ */ new Set();
|
|
1253
|
+
for (const { ord, isoDay } of tokens) {
|
|
1254
|
+
if (ord === 0) {
|
|
1255
|
+
let day = 1 + (isoDay - firstDayOfWeek + 7) % 7;
|
|
1256
|
+
while (day <= lastDay) {
|
|
1257
|
+
byDayHits.add(day);
|
|
1258
|
+
day += 7;
|
|
1259
|
+
}
|
|
1260
|
+
} else {
|
|
1261
|
+
let day;
|
|
1262
|
+
if (ord > 0) {
|
|
1263
|
+
day = 1 + (isoDay - firstDayOfWeek + 7) % 7 + 7 * (ord - 1);
|
|
1264
|
+
} else {
|
|
1265
|
+
const lastMatch = lastDay - (lastDayOfWeek - isoDay + 7) % 7;
|
|
1266
|
+
day = lastMatch + 7 * (ord + 1);
|
|
1267
|
+
}
|
|
1268
|
+
if (day >= 1 && day <= lastDay) {
|
|
1269
|
+
byDayHits.add(day);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
let finalDays = [...byDayHits].sort((a, b) => a - b);
|
|
1274
|
+
if (byMonthDay && byMonthDay.length > 0) {
|
|
1275
|
+
if (byMonthDayHits.length === 0) {
|
|
1276
|
+
return [];
|
|
1277
|
+
}
|
|
1278
|
+
const byMonthDayHitSet = new Set(byMonthDayHits);
|
|
1279
|
+
finalDays = finalDays.filter((d) => byMonthDayHitSet.has(d));
|
|
1280
|
+
}
|
|
1281
|
+
return finalDays;
|
|
1282
|
+
}
|
|
1283
|
+
generateMonthlyOccurrencesOptimizedBySetPos(sample) {
|
|
1284
|
+
if (!this.opts.bySetPos || !this.hasSingleExpandedTimeSlot()) {
|
|
1285
|
+
return null;
|
|
1286
|
+
}
|
|
1287
|
+
const monthStart = sample.day === 1 ? sample : sample.with({ day: 1 });
|
|
1288
|
+
const days = this.generateMonthlyOccurrenceDays(monthStart);
|
|
1289
|
+
if (days.length === 0) {
|
|
1290
|
+
return [];
|
|
1291
|
+
}
|
|
1292
|
+
const selectedDays = this.applyBySetPosToSortedList(days);
|
|
1293
|
+
if (selectedDays.length === 0) {
|
|
1294
|
+
return [];
|
|
1295
|
+
}
|
|
1296
|
+
return selectedDays.sort((a, b) => a - b).map((day) => this.buildMonthlyOccurrenceOnDay(monthStart, day));
|
|
1297
|
+
}
|
|
1298
|
+
isGregorianLeapYear(year) {
|
|
1299
|
+
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
1300
|
+
}
|
|
1301
|
+
daysInGregorianMonth(year, month) {
|
|
1302
|
+
if (month === 2 && this.isGregorianLeapYear(year)) {
|
|
1303
|
+
return 29;
|
|
1304
|
+
}
|
|
1305
|
+
return GREGORIAN_MONTH_LENGTHS[month - 1];
|
|
1306
|
+
}
|
|
1307
|
+
gregorianIsoDayOfWeek(year, month, day) {
|
|
1308
|
+
let adjustedYear = year;
|
|
1309
|
+
if (month < 3) adjustedYear -= 1;
|
|
1310
|
+
const sundayZero = (adjustedYear + Math.floor(adjustedYear / 4) - Math.floor(adjustedYear / 100) + Math.floor(adjustedYear / 400) + GREGORIAN_WEEKDAY_OFFSETS[month - 1] + day) % 7;
|
|
1311
|
+
return sundayZero === 0 ? 7 : sundayZero;
|
|
1312
|
+
}
|
|
1313
|
+
monthIndexToYearMonth(monthIndex) {
|
|
1314
|
+
const year = Math.floor(monthIndex / 12);
|
|
1315
|
+
return {
|
|
1316
|
+
year,
|
|
1317
|
+
month: monthIndex - year * 12 + 1
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
generateMonthlyOccurrenceDaysUtc(year, month) {
|
|
1321
|
+
if (this.numericByMonths && this.numericByMonths.length > 0 && !this.numericByMonths.includes(month)) {
|
|
1322
|
+
return [];
|
|
1323
|
+
}
|
|
1324
|
+
const byMonthDay = this.opts.byMonthDay;
|
|
1325
|
+
const byDay = this.opts.byDay;
|
|
1326
|
+
const lastDay = this.daysInGregorianMonth(year, month);
|
|
1327
|
+
let byMonthDayHits = [];
|
|
1328
|
+
if (byMonthDay && byMonthDay.length > 0) {
|
|
1329
|
+
byMonthDayHits = byMonthDay.map((day) => day > 0 ? day : lastDay + day + 1).filter((day) => day >= 1 && day <= lastDay);
|
|
1330
|
+
byMonthDayHits = [...new Set(byMonthDayHits)].sort((a, b) => a - b);
|
|
1331
|
+
}
|
|
1332
|
+
if (!byDay && byMonthDay && byMonthDay.length > 0) {
|
|
1333
|
+
return byMonthDayHits;
|
|
1334
|
+
}
|
|
1335
|
+
if (!byDay) {
|
|
1336
|
+
const day = this.originalDtstart.day;
|
|
1337
|
+
return day >= 1 && day <= lastDay ? [day] : [];
|
|
1338
|
+
}
|
|
1339
|
+
const tokens = this.parsedByDayTokens;
|
|
1340
|
+
if (!(tokens == null ? void 0 : tokens.length)) return [];
|
|
1341
|
+
const firstDayOfWeek = this.gregorianIsoDayOfWeek(year, month, 1);
|
|
1342
|
+
const lastDayOfWeek = addIsoDays(firstDayOfWeek, lastDay - 1);
|
|
1343
|
+
const byDayHits = /* @__PURE__ */ new Set();
|
|
1344
|
+
for (const { ord, isoDay } of tokens) {
|
|
1345
|
+
if (ord === 0) {
|
|
1346
|
+
let day = 1 + (isoDay - firstDayOfWeek + 7) % 7;
|
|
1347
|
+
while (day <= lastDay) {
|
|
1348
|
+
byDayHits.add(day);
|
|
1349
|
+
day += 7;
|
|
1350
|
+
}
|
|
1351
|
+
} else {
|
|
1352
|
+
let day;
|
|
1353
|
+
if (ord > 0) {
|
|
1354
|
+
day = 1 + (isoDay - firstDayOfWeek + 7) % 7 + 7 * (ord - 1);
|
|
1355
|
+
} else {
|
|
1356
|
+
const lastMatch = lastDay - (lastDayOfWeek - isoDay + 7) % 7;
|
|
1357
|
+
day = lastMatch + 7 * (ord + 1);
|
|
1358
|
+
}
|
|
1359
|
+
if (day >= 1 && day <= lastDay) {
|
|
1360
|
+
byDayHits.add(day);
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
let finalDays = [...byDayHits].sort((a, b) => a - b);
|
|
1365
|
+
if (byMonthDay && byMonthDay.length > 0) {
|
|
1366
|
+
if (byMonthDayHits.length === 0) return [];
|
|
1367
|
+
const byMonthDayHitSet = new Set(byMonthDayHits);
|
|
1368
|
+
finalDays = finalDays.filter((day) => byMonthDayHitSet.has(day));
|
|
1369
|
+
}
|
|
1370
|
+
return finalDays;
|
|
1371
|
+
}
|
|
1372
|
+
generateMonthlyOccurrenceEpochsUtc(year, month) {
|
|
1373
|
+
var _a;
|
|
1374
|
+
const days = this.generateMonthlyOccurrenceDaysUtc(year, month);
|
|
1375
|
+
if (days.length === 0) return [];
|
|
1376
|
+
const monthStartMs = Date.UTC(year, month - 1, 1, 0, 0, 0, 0);
|
|
1377
|
+
const timeSlotOffsets = (_a = this.timeSlotOffsetsMs) != null ? _a : [0];
|
|
1378
|
+
if (this.opts.bySetPos && this.opts.bySetPos.length > 0) {
|
|
1379
|
+
if (timeSlotOffsets.length === 1) {
|
|
1380
|
+
const selectedDays = this.applyBySetPosToSortedList(days).sort((a, b) => a - b);
|
|
1381
|
+
const offset = timeSlotOffsets[0];
|
|
1382
|
+
return selectedDays.map((day) => monthStartMs + (day - 1) * MS_PER_DAY + offset);
|
|
1383
|
+
}
|
|
1384
|
+
const timestamps2 = [];
|
|
1385
|
+
for (const day of days) {
|
|
1386
|
+
const dayBase = monthStartMs + (day - 1) * MS_PER_DAY;
|
|
1387
|
+
for (const offset of timeSlotOffsets) {
|
|
1388
|
+
timestamps2.push(dayBase + offset);
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
return this.applyBySetPosToSortedList(timestamps2).sort((a, b) => a - b);
|
|
1392
|
+
}
|
|
1393
|
+
const timestamps = [];
|
|
1394
|
+
for (const day of days) {
|
|
1395
|
+
const dayBase = monthStartMs + (day - 1) * MS_PER_DAY;
|
|
1396
|
+
for (const offset of timeSlotOffsets) {
|
|
1397
|
+
timestamps.push(dayBase + offset);
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
return timestamps;
|
|
1401
|
+
}
|
|
1402
|
+
_allUtcMonthlyByDayOrMonthDay() {
|
|
1403
|
+
var _a;
|
|
1404
|
+
const dates = [];
|
|
1405
|
+
const startMilliseconds = this.originalDtstart.epochMilliseconds;
|
|
1406
|
+
const untilMilliseconds = (_a = this.opts.until) == null ? void 0 : _a.epochMilliseconds;
|
|
1407
|
+
let iterationCount = 0;
|
|
1408
|
+
if (!this.addDtstartIfNeeded(dates)) {
|
|
1409
|
+
return dates;
|
|
1410
|
+
}
|
|
1411
|
+
let monthIndex = this.originalDtstart.year * 12 + (this.originalDtstart.month - 1);
|
|
1412
|
+
while (true) {
|
|
1413
|
+
if (++iterationCount > this.maxIterations) {
|
|
1414
|
+
throw new Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);
|
|
1415
|
+
}
|
|
1416
|
+
const { year, month } = this.monthIndexToYearMonth(monthIndex);
|
|
1417
|
+
const occurrenceEpochs = this.generateMonthlyOccurrenceEpochsUtc(year, month);
|
|
1418
|
+
for (const epochMilliseconds of occurrenceEpochs) {
|
|
1419
|
+
if (epochMilliseconds < startMilliseconds) {
|
|
1420
|
+
continue;
|
|
1421
|
+
}
|
|
1422
|
+
if (untilMilliseconds !== void 0 && epochMilliseconds > untilMilliseconds) {
|
|
1423
|
+
return dates;
|
|
1424
|
+
}
|
|
1425
|
+
dates.push(this.utcZdtFromEpochMilliseconds(epochMilliseconds));
|
|
1426
|
+
if (this.shouldBreakForCountLimit(dates.length)) {
|
|
1427
|
+
return dates;
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
monthIndex += this.opts.interval;
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
875
1433
|
processOccurrences(occs, dates, start, iterator, extraFilters) {
|
|
876
1434
|
let shouldBreak = false;
|
|
877
1435
|
for (const occ of occs) {
|
|
@@ -915,11 +1473,10 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
915
1473
|
if (++iterationCount > this.maxIterations) {
|
|
916
1474
|
throw new Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);
|
|
917
1475
|
}
|
|
918
|
-
let occs = this.
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
continue;
|
|
1476
|
+
let occs = this.generateMonthlyOccurrencesOptimizedBySetPos(monthCursor);
|
|
1477
|
+
if (!occs) {
|
|
1478
|
+
occs = this.generateMonthlyOccurrences(monthCursor);
|
|
1479
|
+
occs = this.applyBySetPos(occs);
|
|
923
1480
|
}
|
|
924
1481
|
const { shouldBreak } = this.processOccurrences(occs, dates, start, iterator);
|
|
925
1482
|
if (shouldBreak) {
|
|
@@ -930,22 +1487,22 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
930
1487
|
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
931
1488
|
}
|
|
932
1489
|
_allWeekly(iterator) {
|
|
933
|
-
var _a;
|
|
1490
|
+
var _a, _b, _c;
|
|
934
1491
|
const dates = [];
|
|
935
1492
|
let iterationCount = 0;
|
|
936
1493
|
const start = this.originalDtstart;
|
|
937
1494
|
if (!this.addDtstartIfNeeded(dates, iterator)) {
|
|
938
1495
|
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
939
1496
|
}
|
|
940
|
-
const dayMap =
|
|
941
|
-
const
|
|
942
|
-
const dows = tokens.map((tok) => dayMap[tok.slice(-2)]).filter((d) => d !== void 0).sort((a, b) => a - b);
|
|
1497
|
+
const dayMap = weekdayToIsoDay;
|
|
1498
|
+
const dows = this.opts.byDay ? [...(_a = this.allByDayIsoDays) != null ? _a : []] : this.opts.byMonthDay && this.opts.byMonthDay.length > 0 ? [...Object.values(dayMap)] : [start.dayOfWeek];
|
|
943
1499
|
const firstWeekDates = dows.map((dw) => {
|
|
944
1500
|
const delta = (dw - start.dayOfWeek + 7) % 7;
|
|
945
1501
|
return start.add({ days: delta });
|
|
946
1502
|
});
|
|
947
1503
|
const firstOccurrence = firstWeekDates.reduce((a, b) => Temporal.ZonedDateTime.compare(a, b) <= 0 ? a : b);
|
|
948
|
-
const
|
|
1504
|
+
const wkstToken = (_b = extractWeekdayToken(this.opts.wkst || "MO")) != null ? _b : "MO";
|
|
1505
|
+
const wkstDay = (_c = dayMap[wkstToken]) != null ? _c : 1;
|
|
949
1506
|
const firstOccWeekOffset = (firstOccurrence.dayOfWeek - wkstDay + 7) % 7;
|
|
950
1507
|
let weekCursor = firstOccurrence.subtract({ days: firstOccWeekOffset });
|
|
951
1508
|
while (true) {
|
|
@@ -1344,6 +1901,10 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
1344
1901
|
if (!this.opts.count && !this.opts.until && !iterator) {
|
|
1345
1902
|
throw new Error("all() requires iterator when no COUNT/UNTIL");
|
|
1346
1903
|
}
|
|
1904
|
+
const utcFastPathDates = this.allUtcFastPath(iterator);
|
|
1905
|
+
if (utcFastPathDates) {
|
|
1906
|
+
return utcFastPathDates;
|
|
1907
|
+
}
|
|
1347
1908
|
if (this.opts.freq === "MONTHLY" && (this.opts.byDay || this.opts.byMonthDay) && !this.opts.byWeekNo) {
|
|
1348
1909
|
return this._allMonthlyByDayOrMonthDay(iterator);
|
|
1349
1910
|
}
|
|
@@ -1747,58 +2308,14 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
1747
2308
|
* matching your opts.byDay and opts.byMonth (or the single "same day" if no BYDAY).
|
|
1748
2309
|
*/
|
|
1749
2310
|
generateMonthlyOccurrences(sample) {
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
if (byMonth && !byMonth.includes(sample.month)) return [];
|
|
1753
|
-
const lastDay = sample.with({ day: 1 }).add({ months: 1 }).subtract({ days: 1 }).day;
|
|
1754
|
-
let byMonthDayHits = [];
|
|
1755
|
-
if (byMonthDay && byMonthDay.length > 0) {
|
|
1756
|
-
byMonthDayHits = byMonthDay.map((d) => d > 0 ? d : lastDay + d + 1).filter((d) => d >= 1 && d <= lastDay);
|
|
1757
|
-
}
|
|
1758
|
-
if (!byDay && byMonthDay && byMonthDay.length > 0) {
|
|
1759
|
-
if (byMonthDayHits.length === 0) {
|
|
1760
|
-
return [];
|
|
1761
|
-
}
|
|
1762
|
-
const dates = byMonthDayHits.map((d) => sample.with({ day: d }));
|
|
1763
|
-
return dates.flatMap((z) => this.expandByTime(z)).sort((a, b) => Temporal.ZonedDateTime.compare(a, b));
|
|
1764
|
-
}
|
|
1765
|
-
if (!byDay) {
|
|
2311
|
+
const monthStart = sample.day === 1 ? sample : sample.with({ day: 1 });
|
|
2312
|
+
if (!this.opts.byDay && !this.opts.byMonthDay) {
|
|
1766
2313
|
return this.expandByTime(sample);
|
|
1767
2314
|
}
|
|
1768
|
-
const
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
return { ord: m[1] ? parseInt(m[1], 10) : 0, wd: dayMap[m[2]] };
|
|
1773
|
-
}).filter((x) => x !== null);
|
|
1774
|
-
const buckets = {};
|
|
1775
|
-
let cursor = sample.with({ day: 1 });
|
|
1776
|
-
while (cursor.month === sample.month) {
|
|
1777
|
-
const dow = cursor.dayOfWeek;
|
|
1778
|
-
(buckets[dow] || (buckets[dow] = [])).push(cursor.day);
|
|
1779
|
-
cursor = cursor.add({ days: 1 });
|
|
1780
|
-
}
|
|
1781
|
-
const byDayHits = [];
|
|
1782
|
-
for (const { ord, wd } of tokens) {
|
|
1783
|
-
const list = (_a = buckets[wd]) != null ? _a : [];
|
|
1784
|
-
if (!list.length) continue;
|
|
1785
|
-
if (ord === 0) {
|
|
1786
|
-
for (const d of list) byDayHits.push(d);
|
|
1787
|
-
} else {
|
|
1788
|
-
const idx = ord > 0 ? ord - 1 : list.length + ord;
|
|
1789
|
-
const dayN = list[idx];
|
|
1790
|
-
if (dayN) byDayHits.push(dayN);
|
|
1791
|
-
}
|
|
1792
|
-
}
|
|
1793
|
-
let finalDays = byDayHits;
|
|
1794
|
-
if (byMonthDay && byMonthDay.length > 0) {
|
|
1795
|
-
if (byMonthDayHits.length === 0) {
|
|
1796
|
-
return [];
|
|
1797
|
-
}
|
|
1798
|
-
finalDays = finalDays.filter((d) => byMonthDayHits.includes(d));
|
|
1799
|
-
}
|
|
1800
|
-
const hits = finalDays.map((d) => sample.with({ day: d }));
|
|
1801
|
-
return hits.flatMap((z) => this.expandByTime(z)).sort((a, b) => Temporal.ZonedDateTime.compare(a, b));
|
|
2315
|
+
const finalDays = this.generateMonthlyOccurrenceDays(monthStart);
|
|
2316
|
+
if (finalDays.length === 0) return [];
|
|
2317
|
+
const hits = finalDays.map((d) => monthStart.with({ day: d }));
|
|
2318
|
+
return hits.flatMap((z) => this.expandByTime(z));
|
|
1802
2319
|
}
|
|
1803
2320
|
/**
|
|
1804
2321
|
* Given any date in a year, return all ZonedDateTimes in that year matching
|
|
@@ -1810,12 +2327,12 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
1810
2327
|
let occs = [];
|
|
1811
2328
|
const hasOrdinalByDay = this.opts.byDay && this.opts.byDay.some((t) => /^[+-]?\d/.test(t));
|
|
1812
2329
|
if (hasOrdinalByDay && !this.opts.byMonth) {
|
|
1813
|
-
const dayMap =
|
|
2330
|
+
const dayMap = weekdayToIsoDay;
|
|
1814
2331
|
for (const tok of this.opts.byDay) {
|
|
1815
|
-
const
|
|
1816
|
-
if (!
|
|
1817
|
-
const ord =
|
|
1818
|
-
const wd = dayMap[
|
|
2332
|
+
const parsed = parseByDayToken(tok);
|
|
2333
|
+
if (!parsed || parsed.ord === 0) continue;
|
|
2334
|
+
const ord = parsed.ord;
|
|
2335
|
+
const wd = dayMap[parsed.weekday];
|
|
1819
2336
|
let dt;
|
|
1820
2337
|
if (ord > 0) {
|
|
1821
2338
|
const jan1 = sample.with({ month: 1, day: 1 });
|
|
@@ -1879,7 +2396,7 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
1879
2396
|
return occs;
|
|
1880
2397
|
}
|
|
1881
2398
|
addByDay(tokens, weekStart) {
|
|
1882
|
-
const dayMap =
|
|
2399
|
+
const dayMap = weekdayToIsoDay;
|
|
1883
2400
|
const wkst = dayMap[this.opts.wkst || "MO"];
|
|
1884
2401
|
const entries = [];
|
|
1885
2402
|
for (const tok of tokens) {
|
|
@@ -1994,12 +2511,11 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
1994
2511
|
return current;
|
|
1995
2512
|
}
|
|
1996
2513
|
if (this.opts.byDay && !this.matchesByDay(current)) {
|
|
1997
|
-
const
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
const nextDayOfWeek = this.findNextValidValue(current.dayOfWeek, targetDays.sort(), (a, b) => a - b);
|
|
2514
|
+
const targetDays = this.allByDayIsoDays;
|
|
2515
|
+
if (!(targetDays == null ? void 0 : targetDays.length)) {
|
|
2516
|
+
return this.applyTimeOverride(current.add({ days: 1 }).with({ hour: 0, minute: 0, second: 0 }));
|
|
2517
|
+
}
|
|
2518
|
+
const nextDayOfWeek = this.findNextValidValue(current.dayOfWeek, targetDays, (a, b) => a - b);
|
|
2003
2519
|
if (nextDayOfWeek) {
|
|
2004
2520
|
const delta = (nextDayOfWeek - current.dayOfWeek + 7) % 7;
|
|
2005
2521
|
current = current.add({ days: delta }).with({ hour: 0, minute: 0, second: 0 });
|
|
@@ -2033,17 +2549,12 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
2033
2549
|
const { bySetPos } = this.opts;
|
|
2034
2550
|
if (!bySetPos || !bySetPos.length) return list;
|
|
2035
2551
|
const sorted = [...list].sort((a, b) => Temporal.ZonedDateTime.compare(a, b));
|
|
2036
|
-
const out =
|
|
2037
|
-
const len = sorted.length;
|
|
2038
|
-
for (const pos of bySetPos) {
|
|
2039
|
-
const idx = pos > 0 ? pos - 1 : len + pos;
|
|
2040
|
-
if (idx >= 0 && idx < len) out.push(sorted[idx]);
|
|
2041
|
-
}
|
|
2552
|
+
const out = this.applyBySetPosToSortedList(sorted);
|
|
2042
2553
|
return out.sort((a, b) => Temporal.ZonedDateTime.compare(a, b));
|
|
2043
2554
|
}
|
|
2044
2555
|
isoWeekByDay(sample) {
|
|
2045
2556
|
var _a;
|
|
2046
|
-
const dayMap =
|
|
2557
|
+
const dayMap = weekdayToIsoDay;
|
|
2047
2558
|
const wkst = dayMap[this.opts.wkst || "MO"];
|
|
2048
2559
|
const jan1 = sample.with({ month: 1, day: 1 });
|
|
2049
2560
|
const jan4 = sample.with({ month: 1, day: 4 });
|
|
@@ -2051,10 +2562,7 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
2051
2562
|
const firstWeekStart = jan4.subtract({ days: delta });
|
|
2052
2563
|
const isLeapYear = jan1.inLeapYear;
|
|
2053
2564
|
const lastWeek = jan1.dayOfWeek === 4 || isLeapYear && jan1.dayOfWeek === 3 ? 53 : 52;
|
|
2054
|
-
const tokens = ((_a = this.opts.byDay) == null ? void 0 : _a.length) ? this.opts.byDay.map((tok) =>
|
|
2055
|
-
var _a2;
|
|
2056
|
-
return (_a2 = tok.match(/(MO|TU|WE|TH|FR|SA|SU)$/)) == null ? void 0 : _a2[1];
|
|
2057
|
-
}) : [Object.entries(dayMap).find(([, d]) => d === this.originalDtstart.dayOfWeek)[0]];
|
|
2565
|
+
const tokens = ((_a = this.opts.byDay) == null ? void 0 : _a.length) ? this.opts.byDay.map((tok) => extractWeekdayToken(tok)).filter((day) => day !== null) : [Object.entries(dayMap).find(([, d]) => d === this.originalDtstart.dayOfWeek)[0]];
|
|
2058
2566
|
return { lastWeek, firstWeekStart, tokens };
|
|
2059
2567
|
}
|
|
2060
2568
|
/**
|
|
@@ -2172,7 +2680,7 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
2172
2680
|
rscaleMatchesByWeekNo(calId, pd) {
|
|
2173
2681
|
const list = this.opts.byWeekNo;
|
|
2174
2682
|
if (!list || list.length === 0) return true;
|
|
2175
|
-
const dayMap =
|
|
2683
|
+
const dayMap = weekdayToIsoDay;
|
|
2176
2684
|
const wkst = dayMap[this.opts.wkst || "MO"];
|
|
2177
2685
|
const weekStart = pd.subtract({ days: (pd.dayOfWeek - wkst + 7) % 7 });
|
|
2178
2686
|
const thursday = weekStart.add({ days: (4 - wkst + 7) % 7 });
|
|
@@ -2197,11 +2705,8 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
2197
2705
|
rscaleMatchesByDayBasic(pd) {
|
|
2198
2706
|
const byDay = this.opts.byDay;
|
|
2199
2707
|
if (!byDay || byDay.length === 0) return true;
|
|
2200
|
-
const dayMap =
|
|
2201
|
-
const tokens = byDay.map((tok) =>
|
|
2202
|
-
var _a;
|
|
2203
|
-
return (_a = tok.match(/^(?:[+-]?\d{1,2})?(MO|TU|WE|TH|FR|SA|SU)$/)) == null ? void 0 : _a[1];
|
|
2204
|
-
}).filter((x) => !!x);
|
|
2708
|
+
const dayMap = weekdayToIsoDay;
|
|
2709
|
+
const tokens = byDay.map((tok) => extractWeekdayToken(tok)).filter((x) => x !== null);
|
|
2205
2710
|
if (tokens.length === 0) return true;
|
|
2206
2711
|
return tokens.some((wd) => dayMap[wd] === pd.dayOfWeek);
|
|
2207
2712
|
}
|
|
@@ -2246,7 +2751,7 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
2246
2751
|
}
|
|
2247
2752
|
}
|
|
2248
2753
|
if (byDay && byDay.length > 0) {
|
|
2249
|
-
const dayMap =
|
|
2754
|
+
const dayMap = weekdayToIsoDay;
|
|
2250
2755
|
const buckets = {};
|
|
2251
2756
|
let cur = monthStart;
|
|
2252
2757
|
while (cur.month === monthStart.month && cur.year === monthStart.year) {
|
|
@@ -2255,10 +2760,10 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
2255
2760
|
cur = cur.add({ days: 1 });
|
|
2256
2761
|
}
|
|
2257
2762
|
for (const tok of byDay) {
|
|
2258
|
-
const
|
|
2259
|
-
if (!
|
|
2260
|
-
const ord =
|
|
2261
|
-
const wd = dayMap[
|
|
2763
|
+
const parsed = parseByDayToken(tok);
|
|
2764
|
+
if (!parsed) continue;
|
|
2765
|
+
const ord = parsed.ord;
|
|
2766
|
+
const wd = dayMap[parsed.weekday];
|
|
2262
2767
|
const list = buckets[wd] || [];
|
|
2263
2768
|
if (list.length === 0) continue;
|
|
2264
2769
|
if (ord === 0) {
|
|
@@ -2295,15 +2800,12 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
2295
2800
|
let occs = [];
|
|
2296
2801
|
const monthsTokens = this.opts.byMonth;
|
|
2297
2802
|
const months = this.monthsOfYear(calId, tgtYear);
|
|
2298
|
-
const dayMap =
|
|
2803
|
+
const dayMap = weekdayToIsoDay;
|
|
2299
2804
|
const wkst = dayMap[this.opts.wkst || "MO"];
|
|
2300
2805
|
if (this.opts.byWeekNo && this.opts.byWeekNo.length > 0) {
|
|
2301
2806
|
const firstStart = this.rscaleFirstWeekStart(calId, tgtYear, wkst);
|
|
2302
2807
|
const lastWeek = this.rscaleLastWeekCount(calId, tgtYear, wkst);
|
|
2303
|
-
const tokens = ((_b = this.opts.byDay) == null ? void 0 : _b.length) ? this.opts.byDay.map((tok) =>
|
|
2304
|
-
var _a2;
|
|
2305
|
-
return (_a2 = tok.match(/(MO|TU|WE|TH|FR|SA|SU)$/)) == null ? void 0 : _a2[1];
|
|
2306
|
-
}) : [Object.entries(dayMap).find(([, d]) => d === this.originalDtstart.dayOfWeek)[0]];
|
|
2808
|
+
const tokens = ((_b = this.opts.byDay) == null ? void 0 : _b.length) ? this.opts.byDay.map((tok) => extractWeekdayToken(tok)).filter((day) => day !== null) : [Object.entries(dayMap).find(([, d]) => d === this.originalDtstart.dayOfWeek)[0]];
|
|
2307
2809
|
for (const wn of this.opts.byWeekNo) {
|
|
2308
2810
|
let idx = wn > 0 ? wn - 1 : lastWeek + wn;
|
|
2309
2811
|
if (idx < 0 || idx >= lastWeek) continue;
|
|
@@ -2372,12 +2874,9 @@ var _RRuleTemporal = class _RRuleTemporal {
|
|
|
2372
2874
|
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
2373
2875
|
}
|
|
2374
2876
|
if (this.opts.freq === "WEEKLY") {
|
|
2375
|
-
const dayMap =
|
|
2877
|
+
const dayMap = weekdayToIsoDay;
|
|
2376
2878
|
const wkst = dayMap[this.opts.wkst || "MO"];
|
|
2377
|
-
const tokens = ((_c = this.opts.byDay) == null ? void 0 : _c.length) ? this.opts.byDay.map((tok) =>
|
|
2378
|
-
var _a2;
|
|
2379
|
-
return (_a2 = tok.match(/(MO|TU|WE|TH|FR|SA|SU)$/)) == null ? void 0 : _a2[1];
|
|
2380
|
-
}) : [Object.entries(dayMap).find(([, d]) => d === this.originalDtstart.dayOfWeek)[0]];
|
|
2879
|
+
const tokens = ((_c = this.opts.byDay) == null ? void 0 : _c.length) ? this.opts.byDay.map((tok) => extractWeekdayToken(tok)).filter((day) => day !== null) : [Object.entries(dayMap).find(([, d]) => d === this.originalDtstart.dayOfWeek)[0]];
|
|
2381
2880
|
let weekStart = seed.toPlainDate().subtract({ days: (seed.dayOfWeek - wkst + 7) % 7 });
|
|
2382
2881
|
while (true) {
|
|
2383
2882
|
if (++iterationCount > this.maxIterations) {
|
|
@@ -2509,5 +3008,8 @@ _RRuleTemporal.rscaleCalendarSupport = {};
|
|
|
2509
3008
|
var RRuleTemporal = _RRuleTemporal;
|
|
2510
3009
|
|
|
2511
3010
|
export {
|
|
3011
|
+
allowedFreq,
|
|
3012
|
+
allowedWeekdays,
|
|
3013
|
+
weekdayToIsoDay,
|
|
2512
3014
|
RRuleTemporal
|
|
2513
3015
|
};
|