rrule-temporal 1.1.8 → 1.1.10
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-AVNL4A5D.js → chunk-YX5OAV6O.js} +58 -14
- package/dist/index.cjs +58 -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 +58 -14
- package/dist/totext.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
2
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
6
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -14,6 +16,7 @@ var __spreadValues = (a, b) => {
|
|
|
14
16
|
}
|
|
15
17
|
return a;
|
|
16
18
|
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
17
20
|
|
|
18
21
|
// src/index.ts
|
|
19
22
|
import { Temporal } from "@js-temporal/polyfill";
|
|
@@ -149,7 +152,11 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
149
152
|
const parsed = parseRRuleString(params.rruleString, params.tzid);
|
|
150
153
|
this.tzid = (_b = (_a = parsed.tzid) != null ? _a : params.tzid) != null ? _b : "UTC";
|
|
151
154
|
this.originalDtstart = parsed.dtstart;
|
|
152
|
-
manual =
|
|
155
|
+
manual = __spreadProps(__spreadValues({}, parsed), {
|
|
156
|
+
maxIterations: params.maxIterations,
|
|
157
|
+
includeDtstart: params.includeDtstart,
|
|
158
|
+
tzid: this.tzid
|
|
159
|
+
});
|
|
153
160
|
} else {
|
|
154
161
|
manual = __spreadValues({}, params);
|
|
155
162
|
if (typeof manual.dtstart === "string") {
|
|
@@ -611,6 +618,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
611
618
|
}
|
|
612
619
|
addDtstartIfNeeded(dates, iterator) {
|
|
613
620
|
if (this.includeDtstart && !this.matchesAll(this.originalDtstart)) {
|
|
621
|
+
if (iterator && this.isExcluded(this.originalDtstart)) {
|
|
622
|
+
return true;
|
|
623
|
+
}
|
|
614
624
|
if (iterator && !iterator(this.originalDtstart, dates.length)) {
|
|
615
625
|
return false;
|
|
616
626
|
}
|
|
@@ -632,6 +642,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
632
642
|
if (extraFilters && !extraFilters(occ)) {
|
|
633
643
|
continue;
|
|
634
644
|
}
|
|
645
|
+
if (iterator && this.isExcluded(occ)) {
|
|
646
|
+
continue;
|
|
647
|
+
}
|
|
635
648
|
if (iterator && !iterator(occ, dates.length)) {
|
|
636
649
|
shouldBreak = true;
|
|
637
650
|
break;
|
|
@@ -747,6 +760,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
747
760
|
break;
|
|
748
761
|
}
|
|
749
762
|
if (Temporal.ZonedDateTime.compare(candidate, start) >= 0) {
|
|
763
|
+
if (iterator && this.isExcluded(candidate)) {
|
|
764
|
+
continue;
|
|
765
|
+
}
|
|
750
766
|
if (iterator && !iterator(candidate, dates.length)) {
|
|
751
767
|
break;
|
|
752
768
|
}
|
|
@@ -782,6 +798,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
782
798
|
if (this.opts.until && Temporal.ZonedDateTime.compare(occ, this.opts.until) > 0) {
|
|
783
799
|
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
784
800
|
}
|
|
801
|
+
if (iterator && this.isExcluded(occ)) {
|
|
802
|
+
continue;
|
|
803
|
+
}
|
|
785
804
|
if (iterator && !iterator(occ, dates.length)) {
|
|
786
805
|
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
787
806
|
}
|
|
@@ -842,6 +861,10 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
842
861
|
break;
|
|
843
862
|
}
|
|
844
863
|
if (this.matchesAll(current)) {
|
|
864
|
+
if (iterator && this.isExcluded(current)) {
|
|
865
|
+
current = this.nextCandidateSameDate(current);
|
|
866
|
+
continue;
|
|
867
|
+
}
|
|
845
868
|
if (iterator && !iterator(current, dates.length)) {
|
|
846
869
|
break;
|
|
847
870
|
}
|
|
@@ -882,6 +905,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
882
905
|
const occs = this.generateOccurrencesForWeekInYear(year, weekNo);
|
|
883
906
|
for (const occ of occs) {
|
|
884
907
|
if (Temporal.ZonedDateTime.compare(occ, start) >= 0) {
|
|
908
|
+
if (iterator && this.isExcluded(occ)) {
|
|
909
|
+
continue;
|
|
910
|
+
}
|
|
885
911
|
if (iterator && !iterator(occ, dates.length)) {
|
|
886
912
|
break outer_loop;
|
|
887
913
|
}
|
|
@@ -938,6 +964,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
938
964
|
if (this.opts.until && Temporal.ZonedDateTime.compare(occ, this.opts.until) > 0) {
|
|
939
965
|
break outer_loop;
|
|
940
966
|
}
|
|
967
|
+
if (iterator && this.isExcluded(occ)) {
|
|
968
|
+
continue;
|
|
969
|
+
}
|
|
941
970
|
if (iterator && !iterator(occ, dates.length)) {
|
|
942
971
|
break outer_loop;
|
|
943
972
|
}
|
|
@@ -1008,12 +1037,15 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1008
1037
|
let iterationCount = 0;
|
|
1009
1038
|
let current = this.computeFirst();
|
|
1010
1039
|
if (this.includeDtstart && Temporal.ZonedDateTime.compare(current, this.originalDtstart) > 0) {
|
|
1011
|
-
if (iterator &&
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1040
|
+
if (iterator && this.isExcluded(this.originalDtstart)) {
|
|
1041
|
+
} else {
|
|
1042
|
+
if (iterator && !iterator(this.originalDtstart, dates.length)) {
|
|
1043
|
+
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
1044
|
+
}
|
|
1045
|
+
dates.push(this.originalDtstart);
|
|
1046
|
+
if (this.shouldBreakForCountLimit(dates.length)) {
|
|
1047
|
+
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
1048
|
+
}
|
|
1017
1049
|
}
|
|
1018
1050
|
}
|
|
1019
1051
|
while (true) {
|
|
@@ -1024,12 +1056,15 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1024
1056
|
break;
|
|
1025
1057
|
}
|
|
1026
1058
|
if (this.matchesAll(current)) {
|
|
1027
|
-
if (iterator &&
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1059
|
+
if (iterator && this.isExcluded(current)) {
|
|
1060
|
+
} else {
|
|
1061
|
+
if (iterator && !iterator(current, dates.length)) {
|
|
1062
|
+
break;
|
|
1063
|
+
}
|
|
1064
|
+
dates.push(current);
|
|
1065
|
+
if (this.shouldBreakForCountLimit(dates.length)) {
|
|
1066
|
+
break;
|
|
1067
|
+
}
|
|
1033
1068
|
}
|
|
1034
1069
|
}
|
|
1035
1070
|
current = this.nextCandidateSameDate(current);
|
|
@@ -1110,6 +1145,15 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1110
1145
|
}
|
|
1111
1146
|
return dedup;
|
|
1112
1147
|
}
|
|
1148
|
+
/**
|
|
1149
|
+
* Checks if a date is in the exDate list.
|
|
1150
|
+
* @param date - Date to check
|
|
1151
|
+
* @returns True if the date is excluded
|
|
1152
|
+
*/
|
|
1153
|
+
isExcluded(date) {
|
|
1154
|
+
if (!this.opts.exDate || this.opts.exDate.length === 0) return false;
|
|
1155
|
+
return this.opts.exDate.some((exDate) => Temporal.ZonedDateTime.compare(date, exDate) === 0);
|
|
1156
|
+
}
|
|
1113
1157
|
/**
|
|
1114
1158
|
* Excludes exDate entries from the given array of dates.
|
|
1115
1159
|
* @param dates - Array of dates to filter
|
|
@@ -1118,7 +1162,7 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1118
1162
|
excludeExDates(dates) {
|
|
1119
1163
|
if (!this.opts.exDate || this.opts.exDate.length === 0) return dates;
|
|
1120
1164
|
return dates.filter((date) => {
|
|
1121
|
-
return !this.
|
|
1165
|
+
return !this.isExcluded(date);
|
|
1122
1166
|
});
|
|
1123
1167
|
}
|
|
1124
1168
|
/**
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
7
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
@@ -17,6 +19,7 @@ var __spreadValues = (a, b) => {
|
|
|
17
19
|
}
|
|
18
20
|
return a;
|
|
19
21
|
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
23
|
var __export = (target, all) => {
|
|
21
24
|
for (var name in all)
|
|
22
25
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -170,7 +173,11 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
170
173
|
const parsed = parseRRuleString(params.rruleString, params.tzid);
|
|
171
174
|
this.tzid = (_b = (_a = parsed.tzid) != null ? _a : params.tzid) != null ? _b : "UTC";
|
|
172
175
|
this.originalDtstart = parsed.dtstart;
|
|
173
|
-
manual =
|
|
176
|
+
manual = __spreadProps(__spreadValues({}, parsed), {
|
|
177
|
+
maxIterations: params.maxIterations,
|
|
178
|
+
includeDtstart: params.includeDtstart,
|
|
179
|
+
tzid: this.tzid
|
|
180
|
+
});
|
|
174
181
|
} else {
|
|
175
182
|
manual = __spreadValues({}, params);
|
|
176
183
|
if (typeof manual.dtstart === "string") {
|
|
@@ -632,6 +639,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
632
639
|
}
|
|
633
640
|
addDtstartIfNeeded(dates, iterator) {
|
|
634
641
|
if (this.includeDtstart && !this.matchesAll(this.originalDtstart)) {
|
|
642
|
+
if (iterator && this.isExcluded(this.originalDtstart)) {
|
|
643
|
+
return true;
|
|
644
|
+
}
|
|
635
645
|
if (iterator && !iterator(this.originalDtstart, dates.length)) {
|
|
636
646
|
return false;
|
|
637
647
|
}
|
|
@@ -653,6 +663,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
653
663
|
if (extraFilters && !extraFilters(occ)) {
|
|
654
664
|
continue;
|
|
655
665
|
}
|
|
666
|
+
if (iterator && this.isExcluded(occ)) {
|
|
667
|
+
continue;
|
|
668
|
+
}
|
|
656
669
|
if (iterator && !iterator(occ, dates.length)) {
|
|
657
670
|
shouldBreak = true;
|
|
658
671
|
break;
|
|
@@ -768,6 +781,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
768
781
|
break;
|
|
769
782
|
}
|
|
770
783
|
if (import_polyfill.Temporal.ZonedDateTime.compare(candidate, start) >= 0) {
|
|
784
|
+
if (iterator && this.isExcluded(candidate)) {
|
|
785
|
+
continue;
|
|
786
|
+
}
|
|
771
787
|
if (iterator && !iterator(candidate, dates.length)) {
|
|
772
788
|
break;
|
|
773
789
|
}
|
|
@@ -803,6 +819,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
803
819
|
if (this.opts.until && import_polyfill.Temporal.ZonedDateTime.compare(occ, this.opts.until) > 0) {
|
|
804
820
|
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
805
821
|
}
|
|
822
|
+
if (iterator && this.isExcluded(occ)) {
|
|
823
|
+
continue;
|
|
824
|
+
}
|
|
806
825
|
if (iterator && !iterator(occ, dates.length)) {
|
|
807
826
|
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
808
827
|
}
|
|
@@ -863,6 +882,10 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
863
882
|
break;
|
|
864
883
|
}
|
|
865
884
|
if (this.matchesAll(current)) {
|
|
885
|
+
if (iterator && this.isExcluded(current)) {
|
|
886
|
+
current = this.nextCandidateSameDate(current);
|
|
887
|
+
continue;
|
|
888
|
+
}
|
|
866
889
|
if (iterator && !iterator(current, dates.length)) {
|
|
867
890
|
break;
|
|
868
891
|
}
|
|
@@ -903,6 +926,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
903
926
|
const occs = this.generateOccurrencesForWeekInYear(year, weekNo);
|
|
904
927
|
for (const occ of occs) {
|
|
905
928
|
if (import_polyfill.Temporal.ZonedDateTime.compare(occ, start) >= 0) {
|
|
929
|
+
if (iterator && this.isExcluded(occ)) {
|
|
930
|
+
continue;
|
|
931
|
+
}
|
|
906
932
|
if (iterator && !iterator(occ, dates.length)) {
|
|
907
933
|
break outer_loop;
|
|
908
934
|
}
|
|
@@ -959,6 +985,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
959
985
|
if (this.opts.until && import_polyfill.Temporal.ZonedDateTime.compare(occ, this.opts.until) > 0) {
|
|
960
986
|
break outer_loop;
|
|
961
987
|
}
|
|
988
|
+
if (iterator && this.isExcluded(occ)) {
|
|
989
|
+
continue;
|
|
990
|
+
}
|
|
962
991
|
if (iterator && !iterator(occ, dates.length)) {
|
|
963
992
|
break outer_loop;
|
|
964
993
|
}
|
|
@@ -1029,12 +1058,15 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1029
1058
|
let iterationCount = 0;
|
|
1030
1059
|
let current = this.computeFirst();
|
|
1031
1060
|
if (this.includeDtstart && import_polyfill.Temporal.ZonedDateTime.compare(current, this.originalDtstart) > 0) {
|
|
1032
|
-
if (iterator &&
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1061
|
+
if (iterator && this.isExcluded(this.originalDtstart)) {
|
|
1062
|
+
} else {
|
|
1063
|
+
if (iterator && !iterator(this.originalDtstart, dates.length)) {
|
|
1064
|
+
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
1065
|
+
}
|
|
1066
|
+
dates.push(this.originalDtstart);
|
|
1067
|
+
if (this.shouldBreakForCountLimit(dates.length)) {
|
|
1068
|
+
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
1069
|
+
}
|
|
1038
1070
|
}
|
|
1039
1071
|
}
|
|
1040
1072
|
while (true) {
|
|
@@ -1045,12 +1077,15 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1045
1077
|
break;
|
|
1046
1078
|
}
|
|
1047
1079
|
if (this.matchesAll(current)) {
|
|
1048
|
-
if (iterator &&
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1080
|
+
if (iterator && this.isExcluded(current)) {
|
|
1081
|
+
} else {
|
|
1082
|
+
if (iterator && !iterator(current, dates.length)) {
|
|
1083
|
+
break;
|
|
1084
|
+
}
|
|
1085
|
+
dates.push(current);
|
|
1086
|
+
if (this.shouldBreakForCountLimit(dates.length)) {
|
|
1087
|
+
break;
|
|
1088
|
+
}
|
|
1054
1089
|
}
|
|
1055
1090
|
}
|
|
1056
1091
|
current = this.nextCandidateSameDate(current);
|
|
@@ -1131,6 +1166,15 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1131
1166
|
}
|
|
1132
1167
|
return dedup;
|
|
1133
1168
|
}
|
|
1169
|
+
/**
|
|
1170
|
+
* Checks if a date is in the exDate list.
|
|
1171
|
+
* @param date - Date to check
|
|
1172
|
+
* @returns True if the date is excluded
|
|
1173
|
+
*/
|
|
1174
|
+
isExcluded(date) {
|
|
1175
|
+
if (!this.opts.exDate || this.opts.exDate.length === 0) return false;
|
|
1176
|
+
return this.opts.exDate.some((exDate) => import_polyfill.Temporal.ZonedDateTime.compare(date, exDate) === 0);
|
|
1177
|
+
}
|
|
1134
1178
|
/**
|
|
1135
1179
|
* Excludes exDate entries from the given array of dates.
|
|
1136
1180
|
* @param dates - Array of dates to filter
|
|
@@ -1139,7 +1183,7 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1139
1183
|
excludeExDates(dates) {
|
|
1140
1184
|
if (!this.opts.exDate || this.opts.exDate.length === 0) return dates;
|
|
1141
1185
|
return dates.filter((date) => {
|
|
1142
|
-
return !this.
|
|
1186
|
+
return !this.isExcluded(date);
|
|
1143
1187
|
});
|
|
1144
1188
|
}
|
|
1145
1189
|
/**
|
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
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
7
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
@@ -17,6 +19,7 @@ var __spreadValues = (a, b) => {
|
|
|
17
19
|
}
|
|
18
20
|
return a;
|
|
19
21
|
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
23
|
var __export = (target, all) => {
|
|
21
24
|
for (var name in all)
|
|
22
25
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -172,7 +175,11 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
172
175
|
const parsed = parseRRuleString(params.rruleString, params.tzid);
|
|
173
176
|
this.tzid = (_b = (_a = parsed.tzid) != null ? _a : params.tzid) != null ? _b : "UTC";
|
|
174
177
|
this.originalDtstart = parsed.dtstart;
|
|
175
|
-
manual =
|
|
178
|
+
manual = __spreadProps(__spreadValues({}, parsed), {
|
|
179
|
+
maxIterations: params.maxIterations,
|
|
180
|
+
includeDtstart: params.includeDtstart,
|
|
181
|
+
tzid: this.tzid
|
|
182
|
+
});
|
|
176
183
|
} else {
|
|
177
184
|
manual = __spreadValues({}, params);
|
|
178
185
|
if (typeof manual.dtstart === "string") {
|
|
@@ -634,6 +641,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
634
641
|
}
|
|
635
642
|
addDtstartIfNeeded(dates, iterator) {
|
|
636
643
|
if (this.includeDtstart && !this.matchesAll(this.originalDtstart)) {
|
|
644
|
+
if (iterator && this.isExcluded(this.originalDtstart)) {
|
|
645
|
+
return true;
|
|
646
|
+
}
|
|
637
647
|
if (iterator && !iterator(this.originalDtstart, dates.length)) {
|
|
638
648
|
return false;
|
|
639
649
|
}
|
|
@@ -655,6 +665,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
655
665
|
if (extraFilters && !extraFilters(occ)) {
|
|
656
666
|
continue;
|
|
657
667
|
}
|
|
668
|
+
if (iterator && this.isExcluded(occ)) {
|
|
669
|
+
continue;
|
|
670
|
+
}
|
|
658
671
|
if (iterator && !iterator(occ, dates.length)) {
|
|
659
672
|
shouldBreak = true;
|
|
660
673
|
break;
|
|
@@ -770,6 +783,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
770
783
|
break;
|
|
771
784
|
}
|
|
772
785
|
if (import_polyfill.Temporal.ZonedDateTime.compare(candidate, start) >= 0) {
|
|
786
|
+
if (iterator && this.isExcluded(candidate)) {
|
|
787
|
+
continue;
|
|
788
|
+
}
|
|
773
789
|
if (iterator && !iterator(candidate, dates.length)) {
|
|
774
790
|
break;
|
|
775
791
|
}
|
|
@@ -805,6 +821,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
805
821
|
if (this.opts.until && import_polyfill.Temporal.ZonedDateTime.compare(occ, this.opts.until) > 0) {
|
|
806
822
|
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
807
823
|
}
|
|
824
|
+
if (iterator && this.isExcluded(occ)) {
|
|
825
|
+
continue;
|
|
826
|
+
}
|
|
808
827
|
if (iterator && !iterator(occ, dates.length)) {
|
|
809
828
|
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
810
829
|
}
|
|
@@ -865,6 +884,10 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
865
884
|
break;
|
|
866
885
|
}
|
|
867
886
|
if (this.matchesAll(current)) {
|
|
887
|
+
if (iterator && this.isExcluded(current)) {
|
|
888
|
+
current = this.nextCandidateSameDate(current);
|
|
889
|
+
continue;
|
|
890
|
+
}
|
|
868
891
|
if (iterator && !iterator(current, dates.length)) {
|
|
869
892
|
break;
|
|
870
893
|
}
|
|
@@ -905,6 +928,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
905
928
|
const occs = this.generateOccurrencesForWeekInYear(year, weekNo);
|
|
906
929
|
for (const occ of occs) {
|
|
907
930
|
if (import_polyfill.Temporal.ZonedDateTime.compare(occ, start) >= 0) {
|
|
931
|
+
if (iterator && this.isExcluded(occ)) {
|
|
932
|
+
continue;
|
|
933
|
+
}
|
|
908
934
|
if (iterator && !iterator(occ, dates.length)) {
|
|
909
935
|
break outer_loop;
|
|
910
936
|
}
|
|
@@ -961,6 +987,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
961
987
|
if (this.opts.until && import_polyfill.Temporal.ZonedDateTime.compare(occ, this.opts.until) > 0) {
|
|
962
988
|
break outer_loop;
|
|
963
989
|
}
|
|
990
|
+
if (iterator && this.isExcluded(occ)) {
|
|
991
|
+
continue;
|
|
992
|
+
}
|
|
964
993
|
if (iterator && !iterator(occ, dates.length)) {
|
|
965
994
|
break outer_loop;
|
|
966
995
|
}
|
|
@@ -1031,12 +1060,15 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1031
1060
|
let iterationCount = 0;
|
|
1032
1061
|
let current = this.computeFirst();
|
|
1033
1062
|
if (this.includeDtstart && import_polyfill.Temporal.ZonedDateTime.compare(current, this.originalDtstart) > 0) {
|
|
1034
|
-
if (iterator &&
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1063
|
+
if (iterator && this.isExcluded(this.originalDtstart)) {
|
|
1064
|
+
} else {
|
|
1065
|
+
if (iterator && !iterator(this.originalDtstart, dates.length)) {
|
|
1066
|
+
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
1067
|
+
}
|
|
1068
|
+
dates.push(this.originalDtstart);
|
|
1069
|
+
if (this.shouldBreakForCountLimit(dates.length)) {
|
|
1070
|
+
return this.applyCountLimitAndMergeRDates(dates, iterator);
|
|
1071
|
+
}
|
|
1040
1072
|
}
|
|
1041
1073
|
}
|
|
1042
1074
|
while (true) {
|
|
@@ -1047,12 +1079,15 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1047
1079
|
break;
|
|
1048
1080
|
}
|
|
1049
1081
|
if (this.matchesAll(current)) {
|
|
1050
|
-
if (iterator &&
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1082
|
+
if (iterator && this.isExcluded(current)) {
|
|
1083
|
+
} else {
|
|
1084
|
+
if (iterator && !iterator(current, dates.length)) {
|
|
1085
|
+
break;
|
|
1086
|
+
}
|
|
1087
|
+
dates.push(current);
|
|
1088
|
+
if (this.shouldBreakForCountLimit(dates.length)) {
|
|
1089
|
+
break;
|
|
1090
|
+
}
|
|
1056
1091
|
}
|
|
1057
1092
|
}
|
|
1058
1093
|
current = this.nextCandidateSameDate(current);
|
|
@@ -1133,6 +1168,15 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1133
1168
|
}
|
|
1134
1169
|
return dedup;
|
|
1135
1170
|
}
|
|
1171
|
+
/**
|
|
1172
|
+
* Checks if a date is in the exDate list.
|
|
1173
|
+
* @param date - Date to check
|
|
1174
|
+
* @returns True if the date is excluded
|
|
1175
|
+
*/
|
|
1176
|
+
isExcluded(date) {
|
|
1177
|
+
if (!this.opts.exDate || this.opts.exDate.length === 0) return false;
|
|
1178
|
+
return this.opts.exDate.some((exDate) => import_polyfill.Temporal.ZonedDateTime.compare(date, exDate) === 0);
|
|
1179
|
+
}
|
|
1136
1180
|
/**
|
|
1137
1181
|
* Excludes exDate entries from the given array of dates.
|
|
1138
1182
|
* @param dates - Array of dates to filter
|
|
@@ -1141,7 +1185,7 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1141
1185
|
excludeExDates(dates) {
|
|
1142
1186
|
if (!this.opts.exDate || this.opts.exDate.length === 0) return dates;
|
|
1143
1187
|
return dates.filter((date) => {
|
|
1144
|
-
return !this.
|
|
1188
|
+
return !this.isExcluded(date);
|
|
1145
1189
|
});
|
|
1146
1190
|
}
|
|
1147
1191
|
/**
|
package/dist/totext.js
CHANGED