rrule-temporal 1.1.8 → 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.
@@ -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 && !iterator(this.originalDtstart, dates.length)) {
1012
- return this.applyCountLimitAndMergeRDates(dates, iterator);
1013
- }
1014
- dates.push(this.originalDtstart);
1015
- if (this.shouldBreakForCountLimit(dates.length)) {
1016
- return this.applyCountLimitAndMergeRDates(dates, iterator);
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 && !iterator(current, dates.length)) {
1028
- break;
1029
- }
1030
- dates.push(current);
1031
- if (this.shouldBreakForCountLimit(dates.length)) {
1032
- break;
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.opts.exDate.some((exDate) => Temporal.ZonedDateTime.compare(date, exDate) === 0);
1158
+ return !this.isExcluded(date);
1122
1159
  });
1123
1160
  }
1124
1161
  /**
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 && !iterator(this.originalDtstart, dates.length)) {
1033
- return this.applyCountLimitAndMergeRDates(dates, iterator);
1034
- }
1035
- dates.push(this.originalDtstart);
1036
- if (this.shouldBreakForCountLimit(dates.length)) {
1037
- return this.applyCountLimitAndMergeRDates(dates, iterator);
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 && !iterator(current, dates.length)) {
1049
- break;
1050
- }
1051
- dates.push(current);
1052
- if (this.shouldBreakForCountLimit(dates.length)) {
1053
- break;
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.opts.exDate.some((exDate) => import_polyfill.Temporal.ZonedDateTime.compare(date, exDate) === 0);
1179
+ return !this.isExcluded(date);
1143
1180
  });
1144
1181
  }
1145
1182
  /**
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
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  RRuleTemporal
3
- } from "./chunk-AVNL4A5D.js";
3
+ } from "./chunk-EPQ2H4J3.js";
4
4
  export {
5
5
  RRuleTemporal
6
6
  };
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 && !iterator(this.originalDtstart, dates.length)) {
1035
- return this.applyCountLimitAndMergeRDates(dates, iterator);
1036
- }
1037
- dates.push(this.originalDtstart);
1038
- if (this.shouldBreakForCountLimit(dates.length)) {
1039
- return this.applyCountLimitAndMergeRDates(dates, iterator);
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 && !iterator(current, dates.length)) {
1051
- break;
1052
- }
1053
- dates.push(current);
1054
- if (this.shouldBreakForCountLimit(dates.length)) {
1055
- break;
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.opts.exDate.some((exDate) => import_polyfill.Temporal.ZonedDateTime.compare(date, exDate) === 0);
1181
+ return !this.isExcluded(date);
1145
1182
  });
1146
1183
  }
1147
1184
  /**
package/dist/totext.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  RRuleTemporal
3
- } from "./chunk-AVNL4A5D.js";
3
+ } from "./chunk-EPQ2H4J3.js";
4
4
 
5
5
  // src/totext.ts
6
6
  var en = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rrule-temporal",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "description": "Recurrence rule processing using Temporal PlainDate/PlainDateTime",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",