rrule-temporal 1.1.3 → 1.1.4

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/index.d.cts CHANGED
@@ -56,16 +56,19 @@ interface IcsOpts extends BaseOpts {
56
56
  rruleString: string;
57
57
  }
58
58
  type RRuleOptions = ManualOpts | IcsOpts;
59
+ type RRuleTemporalIterator = (date: Temporal.ZonedDateTime, i: number) => boolean;
60
+ type DateFilter = Date | Temporal.ZonedDateTime;
59
61
  declare class RRuleTemporal {
60
- private tzid;
61
- private originalDtstart;
62
- private opts;
63
- private maxIterations;
64
- private includeDtstart;
62
+ private readonly tzid;
63
+ private readonly originalDtstart;
64
+ private readonly opts;
65
+ private readonly maxIterations;
66
+ private readonly includeDtstart;
65
67
  constructor(params: ({
66
68
  rruleString: string;
67
69
  } & BaseOpts) | ManualOpts);
68
70
  private sanitizeNumericArray;
71
+ private sanitizeByDay;
69
72
  private sanitizeOpts;
70
73
  private rawAdvance;
71
74
  /** Expand one base ZonedDateTime into all BYHOUR × BYMINUTE × BYSECOND
@@ -95,7 +98,22 @@ declare class RRuleTemporal {
95
98
  * @param iterator - An optional callback iterator function that can be used to filter or modify the occurrences.
96
99
  * @returns An array of Temporal.ZonedDateTime objects representing all occurrences of the rule.
97
100
  */
98
- all(iterator?: (date: Temporal.ZonedDateTime, i: number) => boolean): Temporal.ZonedDateTime[];
101
+ private _allMonthlyByDayOrMonthDay;
102
+ private _allWeekly;
103
+ private _allMonthlyByMonth;
104
+ private _allYearlyByMonth;
105
+ private _allYearlyComplex;
106
+ private _allMinutelySecondlyComplex;
107
+ private _allMonthlyByWeekNo;
108
+ private _allMonthlyByYearDay;
109
+ private _allDailyMinutelyHourlyWithBySetPos;
110
+ private _allFallback;
111
+ /**
112
+ * Returns all occurrences of the rule.
113
+ * @param iterator - An optional callback iterator function that can be used to filter or modify the occurrences.
114
+ * @returns An array of Temporal.ZonedDateTime objects representing all occurrences of the rule.
115
+ */
116
+ all(iterator?: RRuleTemporalIterator): Temporal.ZonedDateTime[];
99
117
  /**
100
118
  * Converts rDate entries to ZonedDateTime and merges with existing dates.
101
119
  * @param dates - Array of dates to merge with
@@ -128,21 +146,21 @@ declare class RRuleTemporal {
128
146
  * @param inc - Optional boolean flag to include the end date in the results.
129
147
  * @returns An array of Temporal.ZonedDateTime objects representing all occurrences of the rule within the specified time window.
130
148
  */
131
- between(after: Date | Temporal.ZonedDateTime, before: Date | Temporal.ZonedDateTime, inc?: boolean): Temporal.ZonedDateTime[];
149
+ between(after: DateFilter, before: DateFilter, inc?: boolean): Temporal.ZonedDateTime[];
132
150
  /**
133
151
  * Returns the next occurrence of the rule after a specified date.
134
152
  * @param after - The start date or Temporal.ZonedDateTime object.
135
153
  * @param inc - Optional boolean flag to include occurrences on the start date.
136
154
  * @returns The next occurrence of the rule after the specified date or null if no occurrences are found.
137
155
  */
138
- next(after?: Date | Temporal.ZonedDateTime, inc?: boolean): Temporal.ZonedDateTime | null;
156
+ next(after?: DateFilter, inc?: boolean): Temporal.ZonedDateTime | null;
139
157
  /**
140
158
  * Returns the previous occurrence of the rule before a specified date.
141
159
  * @param before - The end date or Temporal.ZonedDateTime object.
142
160
  * @param inc - Optional boolean flag to include occurrences on the end date.
143
161
  * @returns The previous occurrence of the rule before the specified date or null if no occurrences are found.
144
162
  */
145
- previous(before?: Date | Temporal.ZonedDateTime, inc?: boolean): Temporal.ZonedDateTime | null;
163
+ previous(before?: DateFilter, inc?: boolean): Temporal.ZonedDateTime | null;
146
164
  toString(): string;
147
165
  private formatIcsDateTime;
148
166
  private joinDates;
@@ -157,6 +175,7 @@ declare class RRuleTemporal {
157
175
  * if BYMONTH is not specified.
158
176
  */
159
177
  private generateYearlyOccurrences;
178
+ private addByDay;
160
179
  /**
161
180
  * Helper to find the next valid value from a sorted array
162
181
  */
@@ -167,6 +186,11 @@ declare class RRuleTemporal {
167
186
  */
168
187
  private findNextValidDate;
169
188
  private applyBySetPos;
189
+ private isoWeekByDay;
190
+ /**
191
+ * Generate occurrences for a specific week number in a given year
192
+ */
193
+ private generateOccurrencesForWeekInYear;
170
194
  }
171
195
 
172
196
  export { type RRuleOptions, RRuleTemporal };
package/dist/index.d.ts CHANGED
@@ -56,16 +56,19 @@ interface IcsOpts extends BaseOpts {
56
56
  rruleString: string;
57
57
  }
58
58
  type RRuleOptions = ManualOpts | IcsOpts;
59
+ type RRuleTemporalIterator = (date: Temporal.ZonedDateTime, i: number) => boolean;
60
+ type DateFilter = Date | Temporal.ZonedDateTime;
59
61
  declare class RRuleTemporal {
60
- private tzid;
61
- private originalDtstart;
62
- private opts;
63
- private maxIterations;
64
- private includeDtstart;
62
+ private readonly tzid;
63
+ private readonly originalDtstart;
64
+ private readonly opts;
65
+ private readonly maxIterations;
66
+ private readonly includeDtstart;
65
67
  constructor(params: ({
66
68
  rruleString: string;
67
69
  } & BaseOpts) | ManualOpts);
68
70
  private sanitizeNumericArray;
71
+ private sanitizeByDay;
69
72
  private sanitizeOpts;
70
73
  private rawAdvance;
71
74
  /** Expand one base ZonedDateTime into all BYHOUR × BYMINUTE × BYSECOND
@@ -95,7 +98,22 @@ declare class RRuleTemporal {
95
98
  * @param iterator - An optional callback iterator function that can be used to filter or modify the occurrences.
96
99
  * @returns An array of Temporal.ZonedDateTime objects representing all occurrences of the rule.
97
100
  */
98
- all(iterator?: (date: Temporal.ZonedDateTime, i: number) => boolean): Temporal.ZonedDateTime[];
101
+ private _allMonthlyByDayOrMonthDay;
102
+ private _allWeekly;
103
+ private _allMonthlyByMonth;
104
+ private _allYearlyByMonth;
105
+ private _allYearlyComplex;
106
+ private _allMinutelySecondlyComplex;
107
+ private _allMonthlyByWeekNo;
108
+ private _allMonthlyByYearDay;
109
+ private _allDailyMinutelyHourlyWithBySetPos;
110
+ private _allFallback;
111
+ /**
112
+ * Returns all occurrences of the rule.
113
+ * @param iterator - An optional callback iterator function that can be used to filter or modify the occurrences.
114
+ * @returns An array of Temporal.ZonedDateTime objects representing all occurrences of the rule.
115
+ */
116
+ all(iterator?: RRuleTemporalIterator): Temporal.ZonedDateTime[];
99
117
  /**
100
118
  * Converts rDate entries to ZonedDateTime and merges with existing dates.
101
119
  * @param dates - Array of dates to merge with
@@ -128,21 +146,21 @@ declare class RRuleTemporal {
128
146
  * @param inc - Optional boolean flag to include the end date in the results.
129
147
  * @returns An array of Temporal.ZonedDateTime objects representing all occurrences of the rule within the specified time window.
130
148
  */
131
- between(after: Date | Temporal.ZonedDateTime, before: Date | Temporal.ZonedDateTime, inc?: boolean): Temporal.ZonedDateTime[];
149
+ between(after: DateFilter, before: DateFilter, inc?: boolean): Temporal.ZonedDateTime[];
132
150
  /**
133
151
  * Returns the next occurrence of the rule after a specified date.
134
152
  * @param after - The start date or Temporal.ZonedDateTime object.
135
153
  * @param inc - Optional boolean flag to include occurrences on the start date.
136
154
  * @returns The next occurrence of the rule after the specified date or null if no occurrences are found.
137
155
  */
138
- next(after?: Date | Temporal.ZonedDateTime, inc?: boolean): Temporal.ZonedDateTime | null;
156
+ next(after?: DateFilter, inc?: boolean): Temporal.ZonedDateTime | null;
139
157
  /**
140
158
  * Returns the previous occurrence of the rule before a specified date.
141
159
  * @param before - The end date or Temporal.ZonedDateTime object.
142
160
  * @param inc - Optional boolean flag to include occurrences on the end date.
143
161
  * @returns The previous occurrence of the rule before the specified date or null if no occurrences are found.
144
162
  */
145
- previous(before?: Date | Temporal.ZonedDateTime, inc?: boolean): Temporal.ZonedDateTime | null;
163
+ previous(before?: DateFilter, inc?: boolean): Temporal.ZonedDateTime | null;
146
164
  toString(): string;
147
165
  private formatIcsDateTime;
148
166
  private joinDates;
@@ -157,6 +175,7 @@ declare class RRuleTemporal {
157
175
  * if BYMONTH is not specified.
158
176
  */
159
177
  private generateYearlyOccurrences;
178
+ private addByDay;
160
179
  /**
161
180
  * Helper to find the next valid value from a sorted array
162
181
  */
@@ -167,6 +186,11 @@ declare class RRuleTemporal {
167
186
  */
168
187
  private findNextValidDate;
169
188
  private applyBySetPos;
189
+ private isoWeekByDay;
190
+ /**
191
+ * Generate occurrences for a specific week number in a given year
192
+ */
193
+ private generateOccurrencesForWeekInYear;
170
194
  }
171
195
 
172
196
  export { type RRuleOptions, RRuleTemporal };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  RRuleTemporal
3
- } from "./chunk-BFYHWV7H.js";
3
+ } from "./chunk-KT55S4C7.js";
4
4
  export {
5
5
  RRuleTemporal
6
6
  };