rrule-temporal 1.1.7 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-KT55S4C7.js → chunk-EPQ2H4J3.js} +81 -14
- package/dist/index.cjs +81 -14
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1 -1
- package/dist/totext.cjs +81 -14
- package/dist/totext.js +1 -1
- package/package.json +1 -1
|
@@ -611,6 +611,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
611
611
|
}
|
|
612
612
|
addDtstartIfNeeded(dates, iterator) {
|
|
613
613
|
if (this.includeDtstart && !this.matchesAll(this.originalDtstart)) {
|
|
614
|
+
if (iterator && this.isExcluded(this.originalDtstart)) {
|
|
615
|
+
return true;
|
|
616
|
+
}
|
|
614
617
|
if (iterator && !iterator(this.originalDtstart, dates.length)) {
|
|
615
618
|
return false;
|
|
616
619
|
}
|
|
@@ -632,6 +635,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
632
635
|
if (extraFilters && !extraFilters(occ)) {
|
|
633
636
|
continue;
|
|
634
637
|
}
|
|
638
|
+
if (iterator && this.isExcluded(occ)) {
|
|
639
|
+
continue;
|
|
640
|
+
}
|
|
635
641
|
if (iterator && !iterator(occ, dates.length)) {
|
|
636
642
|
shouldBreak = true;
|
|
637
643
|
break;
|
|
@@ -747,6 +753,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
747
753
|
break;
|
|
748
754
|
}
|
|
749
755
|
if (Temporal.ZonedDateTime.compare(candidate, start) >= 0) {
|
|
756
|
+
if (iterator && this.isExcluded(candidate)) {
|
|
757
|
+
continue;
|
|
758
|
+
}
|
|
750
759
|
if (iterator && !iterator(candidate, dates.length)) {
|
|
751
760
|
break;
|
|
752
761
|
}
|
|
@@ -782,6 +791,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
782
791
|
if (this.opts.until && Temporal.ZonedDateTime.compare(occ, this.opts.until) > 0) {
|
|
783
792
|
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
784
793
|
}
|
|
794
|
+
if (iterator && this.isExcluded(occ)) {
|
|
795
|
+
continue;
|
|
796
|
+
}
|
|
785
797
|
if (iterator && !iterator(occ, dates.length)) {
|
|
786
798
|
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
787
799
|
}
|
|
@@ -842,6 +854,10 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
842
854
|
break;
|
|
843
855
|
}
|
|
844
856
|
if (this.matchesAll(current)) {
|
|
857
|
+
if (iterator && this.isExcluded(current)) {
|
|
858
|
+
current = this.nextCandidateSameDate(current);
|
|
859
|
+
continue;
|
|
860
|
+
}
|
|
845
861
|
if (iterator && !iterator(current, dates.length)) {
|
|
846
862
|
break;
|
|
847
863
|
}
|
|
@@ -882,6 +898,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
882
898
|
const occs = this.generateOccurrencesForWeekInYear(year, weekNo);
|
|
883
899
|
for (const occ of occs) {
|
|
884
900
|
if (Temporal.ZonedDateTime.compare(occ, start) >= 0) {
|
|
901
|
+
if (iterator && this.isExcluded(occ)) {
|
|
902
|
+
continue;
|
|
903
|
+
}
|
|
885
904
|
if (iterator && !iterator(occ, dates.length)) {
|
|
886
905
|
break outer_loop;
|
|
887
906
|
}
|
|
@@ -938,6 +957,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
938
957
|
if (this.opts.until && Temporal.ZonedDateTime.compare(occ, this.opts.until) > 0) {
|
|
939
958
|
break outer_loop;
|
|
940
959
|
}
|
|
960
|
+
if (iterator && this.isExcluded(occ)) {
|
|
961
|
+
continue;
|
|
962
|
+
}
|
|
941
963
|
if (iterator && !iterator(occ, dates.length)) {
|
|
942
964
|
break outer_loop;
|
|
943
965
|
}
|
|
@@ -1008,12 +1030,15 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1008
1030
|
let iterationCount = 0;
|
|
1009
1031
|
let current = this.computeFirst();
|
|
1010
1032
|
if (this.includeDtstart && Temporal.ZonedDateTime.compare(current, this.originalDtstart) > 0) {
|
|
1011
|
-
if (iterator &&
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1033
|
+
if (iterator && this.isExcluded(this.originalDtstart)) {
|
|
1034
|
+
} else {
|
|
1035
|
+
if (iterator && !iterator(this.originalDtstart, dates.length)) {
|
|
1036
|
+
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
1037
|
+
}
|
|
1038
|
+
dates.push(this.originalDtstart);
|
|
1039
|
+
if (this.shouldBreakForCountLimit(dates.length)) {
|
|
1040
|
+
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
1041
|
+
}
|
|
1017
1042
|
}
|
|
1018
1043
|
}
|
|
1019
1044
|
while (true) {
|
|
@@ -1024,12 +1049,15 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1024
1049
|
break;
|
|
1025
1050
|
}
|
|
1026
1051
|
if (this.matchesAll(current)) {
|
|
1027
|
-
if (iterator &&
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1052
|
+
if (iterator && this.isExcluded(current)) {
|
|
1053
|
+
} else {
|
|
1054
|
+
if (iterator && !iterator(current, dates.length)) {
|
|
1055
|
+
break;
|
|
1056
|
+
}
|
|
1057
|
+
dates.push(current);
|
|
1058
|
+
if (this.shouldBreakForCountLimit(dates.length)) {
|
|
1059
|
+
break;
|
|
1060
|
+
}
|
|
1033
1061
|
}
|
|
1034
1062
|
}
|
|
1035
1063
|
current = this.nextCandidateSameDate(current);
|
|
@@ -1110,6 +1138,15 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1110
1138
|
}
|
|
1111
1139
|
return dedup;
|
|
1112
1140
|
}
|
|
1141
|
+
/**
|
|
1142
|
+
* Checks if a date is in the exDate list.
|
|
1143
|
+
* @param date - Date to check
|
|
1144
|
+
* @returns True if the date is excluded
|
|
1145
|
+
*/
|
|
1146
|
+
isExcluded(date) {
|
|
1147
|
+
if (!this.opts.exDate || this.opts.exDate.length === 0) return false;
|
|
1148
|
+
return this.opts.exDate.some((exDate) => Temporal.ZonedDateTime.compare(date, exDate) === 0);
|
|
1149
|
+
}
|
|
1113
1150
|
/**
|
|
1114
1151
|
* Excludes exDate entries from the given array of dates.
|
|
1115
1152
|
* @param dates - Array of dates to filter
|
|
@@ -1118,7 +1155,7 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1118
1155
|
excludeExDates(dates) {
|
|
1119
1156
|
if (!this.opts.exDate || this.opts.exDate.length === 0) return dates;
|
|
1120
1157
|
return dates.filter((date) => {
|
|
1121
|
-
return !this.
|
|
1158
|
+
return !this.isExcluded(date);
|
|
1122
1159
|
});
|
|
1123
1160
|
}
|
|
1124
1161
|
/**
|
|
@@ -1166,14 +1203,44 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1166
1203
|
* @returns An array of Temporal.ZonedDateTime objects representing all occurrences of the rule within the specified time window.
|
|
1167
1204
|
*/
|
|
1168
1205
|
between(after, before, inc = false) {
|
|
1206
|
+
var _a;
|
|
1169
1207
|
const startInst = after instanceof Date ? Temporal.Instant.from(after.toISOString()) : after.toInstant();
|
|
1170
1208
|
const endInst = before instanceof Date ? Temporal.Instant.from(before.toISOString()) : before.toInstant();
|
|
1209
|
+
const startZdt = Temporal.Instant.from(startInst).toZonedDateTimeISO(this.tzid);
|
|
1171
1210
|
const beforeZdt = Temporal.Instant.from(endInst).toZonedDateTimeISO(this.tzid);
|
|
1172
1211
|
const tempOpts = __spreadValues({}, this.opts);
|
|
1173
1212
|
if (!tempOpts.until || Temporal.ZonedDateTime.compare(beforeZdt, tempOpts.until) < 0) {
|
|
1174
1213
|
tempOpts.until = beforeZdt;
|
|
1175
1214
|
}
|
|
1176
|
-
|
|
1215
|
+
if (tempOpts.count === void 0) {
|
|
1216
|
+
const interval = (_a = tempOpts.interval) != null ? _a : 1;
|
|
1217
|
+
let duration;
|
|
1218
|
+
switch (tempOpts.freq) {
|
|
1219
|
+
case "YEARLY":
|
|
1220
|
+
duration = { years: interval };
|
|
1221
|
+
break;
|
|
1222
|
+
case "MONTHLY":
|
|
1223
|
+
duration = { months: interval };
|
|
1224
|
+
break;
|
|
1225
|
+
case "WEEKLY":
|
|
1226
|
+
duration = { weeks: interval };
|
|
1227
|
+
break;
|
|
1228
|
+
case "DAILY":
|
|
1229
|
+
duration = { days: interval };
|
|
1230
|
+
break;
|
|
1231
|
+
case "HOURLY":
|
|
1232
|
+
duration = { hours: interval };
|
|
1233
|
+
break;
|
|
1234
|
+
case "MINUTELY":
|
|
1235
|
+
duration = { minutes: interval };
|
|
1236
|
+
break;
|
|
1237
|
+
default:
|
|
1238
|
+
duration = { seconds: interval };
|
|
1239
|
+
}
|
|
1240
|
+
const aligned = startZdt.withPlainTime(this.originalDtstart.toPlainTime());
|
|
1241
|
+
const candidate = aligned.subtract(duration);
|
|
1242
|
+
tempOpts.dtstart = Temporal.ZonedDateTime.compare(candidate, this.opts.dtstart) > 0 ? candidate : this.opts.dtstart;
|
|
1243
|
+
}
|
|
1177
1244
|
const tempRule = new _RRuleTemporal(tempOpts);
|
|
1178
1245
|
const allDates = tempRule.all();
|
|
1179
1246
|
return allDates.filter((date) => {
|
package/dist/index.cjs
CHANGED
|
@@ -632,6 +632,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
632
632
|
}
|
|
633
633
|
addDtstartIfNeeded(dates, iterator) {
|
|
634
634
|
if (this.includeDtstart && !this.matchesAll(this.originalDtstart)) {
|
|
635
|
+
if (iterator && this.isExcluded(this.originalDtstart)) {
|
|
636
|
+
return true;
|
|
637
|
+
}
|
|
635
638
|
if (iterator && !iterator(this.originalDtstart, dates.length)) {
|
|
636
639
|
return false;
|
|
637
640
|
}
|
|
@@ -653,6 +656,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
653
656
|
if (extraFilters && !extraFilters(occ)) {
|
|
654
657
|
continue;
|
|
655
658
|
}
|
|
659
|
+
if (iterator && this.isExcluded(occ)) {
|
|
660
|
+
continue;
|
|
661
|
+
}
|
|
656
662
|
if (iterator && !iterator(occ, dates.length)) {
|
|
657
663
|
shouldBreak = true;
|
|
658
664
|
break;
|
|
@@ -768,6 +774,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
768
774
|
break;
|
|
769
775
|
}
|
|
770
776
|
if (import_polyfill.Temporal.ZonedDateTime.compare(candidate, start) >= 0) {
|
|
777
|
+
if (iterator && this.isExcluded(candidate)) {
|
|
778
|
+
continue;
|
|
779
|
+
}
|
|
771
780
|
if (iterator && !iterator(candidate, dates.length)) {
|
|
772
781
|
break;
|
|
773
782
|
}
|
|
@@ -803,6 +812,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
803
812
|
if (this.opts.until && import_polyfill.Temporal.ZonedDateTime.compare(occ, this.opts.until) > 0) {
|
|
804
813
|
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
805
814
|
}
|
|
815
|
+
if (iterator && this.isExcluded(occ)) {
|
|
816
|
+
continue;
|
|
817
|
+
}
|
|
806
818
|
if (iterator && !iterator(occ, dates.length)) {
|
|
807
819
|
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
808
820
|
}
|
|
@@ -863,6 +875,10 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
863
875
|
break;
|
|
864
876
|
}
|
|
865
877
|
if (this.matchesAll(current)) {
|
|
878
|
+
if (iterator && this.isExcluded(current)) {
|
|
879
|
+
current = this.nextCandidateSameDate(current);
|
|
880
|
+
continue;
|
|
881
|
+
}
|
|
866
882
|
if (iterator && !iterator(current, dates.length)) {
|
|
867
883
|
break;
|
|
868
884
|
}
|
|
@@ -903,6 +919,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
903
919
|
const occs = this.generateOccurrencesForWeekInYear(year, weekNo);
|
|
904
920
|
for (const occ of occs) {
|
|
905
921
|
if (import_polyfill.Temporal.ZonedDateTime.compare(occ, start) >= 0) {
|
|
922
|
+
if (iterator && this.isExcluded(occ)) {
|
|
923
|
+
continue;
|
|
924
|
+
}
|
|
906
925
|
if (iterator && !iterator(occ, dates.length)) {
|
|
907
926
|
break outer_loop;
|
|
908
927
|
}
|
|
@@ -959,6 +978,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
959
978
|
if (this.opts.until && import_polyfill.Temporal.ZonedDateTime.compare(occ, this.opts.until) > 0) {
|
|
960
979
|
break outer_loop;
|
|
961
980
|
}
|
|
981
|
+
if (iterator && this.isExcluded(occ)) {
|
|
982
|
+
continue;
|
|
983
|
+
}
|
|
962
984
|
if (iterator && !iterator(occ, dates.length)) {
|
|
963
985
|
break outer_loop;
|
|
964
986
|
}
|
|
@@ -1029,12 +1051,15 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1029
1051
|
let iterationCount = 0;
|
|
1030
1052
|
let current = this.computeFirst();
|
|
1031
1053
|
if (this.includeDtstart && import_polyfill.Temporal.ZonedDateTime.compare(current, this.originalDtstart) > 0) {
|
|
1032
|
-
if (iterator &&
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1054
|
+
if (iterator && this.isExcluded(this.originalDtstart)) {
|
|
1055
|
+
} else {
|
|
1056
|
+
if (iterator && !iterator(this.originalDtstart, dates.length)) {
|
|
1057
|
+
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
1058
|
+
}
|
|
1059
|
+
dates.push(this.originalDtstart);
|
|
1060
|
+
if (this.shouldBreakForCountLimit(dates.length)) {
|
|
1061
|
+
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
1062
|
+
}
|
|
1038
1063
|
}
|
|
1039
1064
|
}
|
|
1040
1065
|
while (true) {
|
|
@@ -1045,12 +1070,15 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1045
1070
|
break;
|
|
1046
1071
|
}
|
|
1047
1072
|
if (this.matchesAll(current)) {
|
|
1048
|
-
if (iterator &&
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1073
|
+
if (iterator && this.isExcluded(current)) {
|
|
1074
|
+
} else {
|
|
1075
|
+
if (iterator && !iterator(current, dates.length)) {
|
|
1076
|
+
break;
|
|
1077
|
+
}
|
|
1078
|
+
dates.push(current);
|
|
1079
|
+
if (this.shouldBreakForCountLimit(dates.length)) {
|
|
1080
|
+
break;
|
|
1081
|
+
}
|
|
1054
1082
|
}
|
|
1055
1083
|
}
|
|
1056
1084
|
current = this.nextCandidateSameDate(current);
|
|
@@ -1131,6 +1159,15 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1131
1159
|
}
|
|
1132
1160
|
return dedup;
|
|
1133
1161
|
}
|
|
1162
|
+
/**
|
|
1163
|
+
* Checks if a date is in the exDate list.
|
|
1164
|
+
* @param date - Date to check
|
|
1165
|
+
* @returns True if the date is excluded
|
|
1166
|
+
*/
|
|
1167
|
+
isExcluded(date) {
|
|
1168
|
+
if (!this.opts.exDate || this.opts.exDate.length === 0) return false;
|
|
1169
|
+
return this.opts.exDate.some((exDate) => import_polyfill.Temporal.ZonedDateTime.compare(date, exDate) === 0);
|
|
1170
|
+
}
|
|
1134
1171
|
/**
|
|
1135
1172
|
* Excludes exDate entries from the given array of dates.
|
|
1136
1173
|
* @param dates - Array of dates to filter
|
|
@@ -1139,7 +1176,7 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1139
1176
|
excludeExDates(dates) {
|
|
1140
1177
|
if (!this.opts.exDate || this.opts.exDate.length === 0) return dates;
|
|
1141
1178
|
return dates.filter((date) => {
|
|
1142
|
-
return !this.
|
|
1179
|
+
return !this.isExcluded(date);
|
|
1143
1180
|
});
|
|
1144
1181
|
}
|
|
1145
1182
|
/**
|
|
@@ -1187,14 +1224,44 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1187
1224
|
* @returns An array of Temporal.ZonedDateTime objects representing all occurrences of the rule within the specified time window.
|
|
1188
1225
|
*/
|
|
1189
1226
|
between(after, before, inc = false) {
|
|
1227
|
+
var _a;
|
|
1190
1228
|
const startInst = after instanceof Date ? import_polyfill.Temporal.Instant.from(after.toISOString()) : after.toInstant();
|
|
1191
1229
|
const endInst = before instanceof Date ? import_polyfill.Temporal.Instant.from(before.toISOString()) : before.toInstant();
|
|
1230
|
+
const startZdt = import_polyfill.Temporal.Instant.from(startInst).toZonedDateTimeISO(this.tzid);
|
|
1192
1231
|
const beforeZdt = import_polyfill.Temporal.Instant.from(endInst).toZonedDateTimeISO(this.tzid);
|
|
1193
1232
|
const tempOpts = __spreadValues({}, this.opts);
|
|
1194
1233
|
if (!tempOpts.until || import_polyfill.Temporal.ZonedDateTime.compare(beforeZdt, tempOpts.until) < 0) {
|
|
1195
1234
|
tempOpts.until = beforeZdt;
|
|
1196
1235
|
}
|
|
1197
|
-
|
|
1236
|
+
if (tempOpts.count === void 0) {
|
|
1237
|
+
const interval = (_a = tempOpts.interval) != null ? _a : 1;
|
|
1238
|
+
let duration;
|
|
1239
|
+
switch (tempOpts.freq) {
|
|
1240
|
+
case "YEARLY":
|
|
1241
|
+
duration = { years: interval };
|
|
1242
|
+
break;
|
|
1243
|
+
case "MONTHLY":
|
|
1244
|
+
duration = { months: interval };
|
|
1245
|
+
break;
|
|
1246
|
+
case "WEEKLY":
|
|
1247
|
+
duration = { weeks: interval };
|
|
1248
|
+
break;
|
|
1249
|
+
case "DAILY":
|
|
1250
|
+
duration = { days: interval };
|
|
1251
|
+
break;
|
|
1252
|
+
case "HOURLY":
|
|
1253
|
+
duration = { hours: interval };
|
|
1254
|
+
break;
|
|
1255
|
+
case "MINUTELY":
|
|
1256
|
+
duration = { minutes: interval };
|
|
1257
|
+
break;
|
|
1258
|
+
default:
|
|
1259
|
+
duration = { seconds: interval };
|
|
1260
|
+
}
|
|
1261
|
+
const aligned = startZdt.withPlainTime(this.originalDtstart.toPlainTime());
|
|
1262
|
+
const candidate = aligned.subtract(duration);
|
|
1263
|
+
tempOpts.dtstart = import_polyfill.Temporal.ZonedDateTime.compare(candidate, this.opts.dtstart) > 0 ? candidate : this.opts.dtstart;
|
|
1264
|
+
}
|
|
1198
1265
|
const tempRule = new _RRuleTemporal(tempOpts);
|
|
1199
1266
|
const allDates = tempRule.all();
|
|
1200
1267
|
return allDates.filter((date) => {
|
package/dist/index.d.cts
CHANGED
|
@@ -120,6 +120,12 @@ declare class RRuleTemporal {
|
|
|
120
120
|
* @returns Merged and deduplicated array of dates
|
|
121
121
|
*/
|
|
122
122
|
private mergeAndDeduplicateRDates;
|
|
123
|
+
/**
|
|
124
|
+
* Checks if a date is in the exDate list.
|
|
125
|
+
* @param date - Date to check
|
|
126
|
+
* @returns True if the date is excluded
|
|
127
|
+
*/
|
|
128
|
+
private isExcluded;
|
|
123
129
|
/**
|
|
124
130
|
* Excludes exDate entries from the given array of dates.
|
|
125
131
|
* @param dates - Array of dates to filter
|
package/dist/index.d.ts
CHANGED
|
@@ -120,6 +120,12 @@ declare class RRuleTemporal {
|
|
|
120
120
|
* @returns Merged and deduplicated array of dates
|
|
121
121
|
*/
|
|
122
122
|
private mergeAndDeduplicateRDates;
|
|
123
|
+
/**
|
|
124
|
+
* Checks if a date is in the exDate list.
|
|
125
|
+
* @param date - Date to check
|
|
126
|
+
* @returns True if the date is excluded
|
|
127
|
+
*/
|
|
128
|
+
private isExcluded;
|
|
123
129
|
/**
|
|
124
130
|
* Excludes exDate entries from the given array of dates.
|
|
125
131
|
* @param dates - Array of dates to filter
|
package/dist/index.js
CHANGED
package/dist/totext.cjs
CHANGED
|
@@ -634,6 +634,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
634
634
|
}
|
|
635
635
|
addDtstartIfNeeded(dates, iterator) {
|
|
636
636
|
if (this.includeDtstart && !this.matchesAll(this.originalDtstart)) {
|
|
637
|
+
if (iterator && this.isExcluded(this.originalDtstart)) {
|
|
638
|
+
return true;
|
|
639
|
+
}
|
|
637
640
|
if (iterator && !iterator(this.originalDtstart, dates.length)) {
|
|
638
641
|
return false;
|
|
639
642
|
}
|
|
@@ -655,6 +658,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
655
658
|
if (extraFilters && !extraFilters(occ)) {
|
|
656
659
|
continue;
|
|
657
660
|
}
|
|
661
|
+
if (iterator && this.isExcluded(occ)) {
|
|
662
|
+
continue;
|
|
663
|
+
}
|
|
658
664
|
if (iterator && !iterator(occ, dates.length)) {
|
|
659
665
|
shouldBreak = true;
|
|
660
666
|
break;
|
|
@@ -770,6 +776,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
770
776
|
break;
|
|
771
777
|
}
|
|
772
778
|
if (import_polyfill.Temporal.ZonedDateTime.compare(candidate, start) >= 0) {
|
|
779
|
+
if (iterator && this.isExcluded(candidate)) {
|
|
780
|
+
continue;
|
|
781
|
+
}
|
|
773
782
|
if (iterator && !iterator(candidate, dates.length)) {
|
|
774
783
|
break;
|
|
775
784
|
}
|
|
@@ -805,6 +814,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
805
814
|
if (this.opts.until && import_polyfill.Temporal.ZonedDateTime.compare(occ, this.opts.until) > 0) {
|
|
806
815
|
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
807
816
|
}
|
|
817
|
+
if (iterator && this.isExcluded(occ)) {
|
|
818
|
+
continue;
|
|
819
|
+
}
|
|
808
820
|
if (iterator && !iterator(occ, dates.length)) {
|
|
809
821
|
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
810
822
|
}
|
|
@@ -865,6 +877,10 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
865
877
|
break;
|
|
866
878
|
}
|
|
867
879
|
if (this.matchesAll(current)) {
|
|
880
|
+
if (iterator && this.isExcluded(current)) {
|
|
881
|
+
current = this.nextCandidateSameDate(current);
|
|
882
|
+
continue;
|
|
883
|
+
}
|
|
868
884
|
if (iterator && !iterator(current, dates.length)) {
|
|
869
885
|
break;
|
|
870
886
|
}
|
|
@@ -905,6 +921,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
905
921
|
const occs = this.generateOccurrencesForWeekInYear(year, weekNo);
|
|
906
922
|
for (const occ of occs) {
|
|
907
923
|
if (import_polyfill.Temporal.ZonedDateTime.compare(occ, start) >= 0) {
|
|
924
|
+
if (iterator && this.isExcluded(occ)) {
|
|
925
|
+
continue;
|
|
926
|
+
}
|
|
908
927
|
if (iterator && !iterator(occ, dates.length)) {
|
|
909
928
|
break outer_loop;
|
|
910
929
|
}
|
|
@@ -961,6 +980,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
961
980
|
if (this.opts.until && import_polyfill.Temporal.ZonedDateTime.compare(occ, this.opts.until) > 0) {
|
|
962
981
|
break outer_loop;
|
|
963
982
|
}
|
|
983
|
+
if (iterator && this.isExcluded(occ)) {
|
|
984
|
+
continue;
|
|
985
|
+
}
|
|
964
986
|
if (iterator && !iterator(occ, dates.length)) {
|
|
965
987
|
break outer_loop;
|
|
966
988
|
}
|
|
@@ -1031,12 +1053,15 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1031
1053
|
let iterationCount = 0;
|
|
1032
1054
|
let current = this.computeFirst();
|
|
1033
1055
|
if (this.includeDtstart && import_polyfill.Temporal.ZonedDateTime.compare(current, this.originalDtstart) > 0) {
|
|
1034
|
-
if (iterator &&
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1056
|
+
if (iterator && this.isExcluded(this.originalDtstart)) {
|
|
1057
|
+
} else {
|
|
1058
|
+
if (iterator && !iterator(this.originalDtstart, dates.length)) {
|
|
1059
|
+
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
1060
|
+
}
|
|
1061
|
+
dates.push(this.originalDtstart);
|
|
1062
|
+
if (this.shouldBreakForCountLimit(dates.length)) {
|
|
1063
|
+
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
1064
|
+
}
|
|
1040
1065
|
}
|
|
1041
1066
|
}
|
|
1042
1067
|
while (true) {
|
|
@@ -1047,12 +1072,15 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1047
1072
|
break;
|
|
1048
1073
|
}
|
|
1049
1074
|
if (this.matchesAll(current)) {
|
|
1050
|
-
if (iterator &&
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1075
|
+
if (iterator && this.isExcluded(current)) {
|
|
1076
|
+
} else {
|
|
1077
|
+
if (iterator && !iterator(current, dates.length)) {
|
|
1078
|
+
break;
|
|
1079
|
+
}
|
|
1080
|
+
dates.push(current);
|
|
1081
|
+
if (this.shouldBreakForCountLimit(dates.length)) {
|
|
1082
|
+
break;
|
|
1083
|
+
}
|
|
1056
1084
|
}
|
|
1057
1085
|
}
|
|
1058
1086
|
current = this.nextCandidateSameDate(current);
|
|
@@ -1133,6 +1161,15 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1133
1161
|
}
|
|
1134
1162
|
return dedup;
|
|
1135
1163
|
}
|
|
1164
|
+
/**
|
|
1165
|
+
* Checks if a date is in the exDate list.
|
|
1166
|
+
* @param date - Date to check
|
|
1167
|
+
* @returns True if the date is excluded
|
|
1168
|
+
*/
|
|
1169
|
+
isExcluded(date) {
|
|
1170
|
+
if (!this.opts.exDate || this.opts.exDate.length === 0) return false;
|
|
1171
|
+
return this.opts.exDate.some((exDate) => import_polyfill.Temporal.ZonedDateTime.compare(date, exDate) === 0);
|
|
1172
|
+
}
|
|
1136
1173
|
/**
|
|
1137
1174
|
* Excludes exDate entries from the given array of dates.
|
|
1138
1175
|
* @param dates - Array of dates to filter
|
|
@@ -1141,7 +1178,7 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1141
1178
|
excludeExDates(dates) {
|
|
1142
1179
|
if (!this.opts.exDate || this.opts.exDate.length === 0) return dates;
|
|
1143
1180
|
return dates.filter((date) => {
|
|
1144
|
-
return !this.
|
|
1181
|
+
return !this.isExcluded(date);
|
|
1145
1182
|
});
|
|
1146
1183
|
}
|
|
1147
1184
|
/**
|
|
@@ -1189,14 +1226,44 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1189
1226
|
* @returns An array of Temporal.ZonedDateTime objects representing all occurrences of the rule within the specified time window.
|
|
1190
1227
|
*/
|
|
1191
1228
|
between(after, before, inc = false) {
|
|
1229
|
+
var _a;
|
|
1192
1230
|
const startInst = after instanceof Date ? import_polyfill.Temporal.Instant.from(after.toISOString()) : after.toInstant();
|
|
1193
1231
|
const endInst = before instanceof Date ? import_polyfill.Temporal.Instant.from(before.toISOString()) : before.toInstant();
|
|
1232
|
+
const startZdt = import_polyfill.Temporal.Instant.from(startInst).toZonedDateTimeISO(this.tzid);
|
|
1194
1233
|
const beforeZdt = import_polyfill.Temporal.Instant.from(endInst).toZonedDateTimeISO(this.tzid);
|
|
1195
1234
|
const tempOpts = __spreadValues({}, this.opts);
|
|
1196
1235
|
if (!tempOpts.until || import_polyfill.Temporal.ZonedDateTime.compare(beforeZdt, tempOpts.until) < 0) {
|
|
1197
1236
|
tempOpts.until = beforeZdt;
|
|
1198
1237
|
}
|
|
1199
|
-
|
|
1238
|
+
if (tempOpts.count === void 0) {
|
|
1239
|
+
const interval = (_a = tempOpts.interval) != null ? _a : 1;
|
|
1240
|
+
let duration;
|
|
1241
|
+
switch (tempOpts.freq) {
|
|
1242
|
+
case "YEARLY":
|
|
1243
|
+
duration = { years: interval };
|
|
1244
|
+
break;
|
|
1245
|
+
case "MONTHLY":
|
|
1246
|
+
duration = { months: interval };
|
|
1247
|
+
break;
|
|
1248
|
+
case "WEEKLY":
|
|
1249
|
+
duration = { weeks: interval };
|
|
1250
|
+
break;
|
|
1251
|
+
case "DAILY":
|
|
1252
|
+
duration = { days: interval };
|
|
1253
|
+
break;
|
|
1254
|
+
case "HOURLY":
|
|
1255
|
+
duration = { hours: interval };
|
|
1256
|
+
break;
|
|
1257
|
+
case "MINUTELY":
|
|
1258
|
+
duration = { minutes: interval };
|
|
1259
|
+
break;
|
|
1260
|
+
default:
|
|
1261
|
+
duration = { seconds: interval };
|
|
1262
|
+
}
|
|
1263
|
+
const aligned = startZdt.withPlainTime(this.originalDtstart.toPlainTime());
|
|
1264
|
+
const candidate = aligned.subtract(duration);
|
|
1265
|
+
tempOpts.dtstart = import_polyfill.Temporal.ZonedDateTime.compare(candidate, this.opts.dtstart) > 0 ? candidate : this.opts.dtstart;
|
|
1266
|
+
}
|
|
1200
1267
|
const tempRule = new _RRuleTemporal(tempOpts);
|
|
1201
1268
|
const allDates = tempRule.all();
|
|
1202
1269
|
return allDates.filter((date) => {
|
package/dist/totext.js
CHANGED