rrule-temporal 2.2.8 → 2.2.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/README.md CHANGED
@@ -6,6 +6,8 @@ The library accepts the familiar `RRULE` format and returns
6
6
 
7
7
  See the [demo site](https://ggaabe.github.io/rrule-temporal/) for an interactive playground.
8
8
 
9
+ If rrule-temporal saves you or your company time, please consider [sponsoring it](https://github.com/sponsors/ggaabe).
10
+
9
11
  > RRule-temporal was created to advance the JS RRule ecosystem to use Temporal instead of Date, and to properly support cross-timezone and calendar aware recurrence rules, as per the suggestion of rrule.js contributors.
10
12
  >https://github.com/jkbrzt/rrule/issues/450#issuecomment-1055853095
11
13
 
@@ -112,7 +114,7 @@ below. These correspond to the recurrence rule parts defined in RFC 5545:
112
114
  | `exDate` | Exception dates to exclude. |
113
115
  | `tzid` | Time zone identifier for interpreting dates. |
114
116
  | `maxIterations` | Safety cap for advancing outer recurrence periods (defaults to 10,000). |
115
- | `maxCandidateEvaluations` | Safety cap for candidate datetimes evaluated within recurrence periods (defaults to 1,000,000). |
117
+ | `maxCandidateEvaluations` | Safety cap for candidate datetimes evaluated within recurrence periods (defaults to 1,000,000). A query that passes it throws; raise it for a window of more dates. |
116
118
  | `includeDtstart` | Include `DTSTART` even if it does not match the pattern. |
117
119
  | `strict` | Enforce RFC 5545 constraints strictly (defaults to false). |
118
120
  | `temporal` | Optional Temporal namespace used for public output values and their inferred types. |
@@ -492,6 +494,14 @@ change with the runtime.
492
494
 
493
495
  ## Sponsor
494
496
 
495
- If this library saves you time, sponsorship helps keep it maintained.
497
+ rrule-temporal powers RRULE scheduling in [pg-boss](https://github.com/timgit/pg-boss), is used by [node-ical](https://github.com/jens-maus/node-ical), and is installed millions of times a week. [Sponsoring it on GitHub](https://github.com/sponsors/ggaabe) helps keep it maintained. Company sponsors get a link here and on the [demo site](https://ggaabe.github.io/rrule-temporal/).
498
+
499
+ ### Bronze sponsors
500
+
501
+ > [PostalForm 💌](https://postalform.com/?utm_source=github&utm_medium=readme&utm_campaign=rrule-temporal) — upload a PDF and we print + mail it via USPS (no printer or stamps needed). The only mailing platform for AI Agents via MCP, and the easiest one for humans!
502
+
503
+ Need help with recurring events, time zones, or iCalendar in your own product? I'm available for consulting: reach me on [X](https://x.com/gabgarrett).
504
+
505
+ ## Author
496
506
 
497
- > This library is sponsored by [PostalForm 💌](https://postalform.com/?utm_source=github&utm_medium=readme&utm_campaign=rrule-temporal) — upload a PDF and we print + mail it via USPS (no printer or stamps needed). The only mailing platform for AI Agents via MCP, and the easiest one for humans!
507
+ Built and maintained by [Gabriel Garrett](https://github.com/ggaabe).
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./src-DcoDqR4A.cjs`);exports.RRuleTemporal=e.t,exports.allowedFreq=e.n,exports.allowedWeekdays=e.r,exports.weekdayToIsoDay=e.i;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./src-Bca2eRPm.cjs`);exports.RRuleTemporal=e.t,exports.allowedFreq=e.n,exports.allowedWeekdays=e.r,exports.weekdayToIsoDay=e.i;
package/dist/index.d.cts CHANGED
@@ -136,6 +136,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
136
136
  private numericQueryPlanCache;
137
137
  private periodQueryPlanCache;
138
138
  private dtstartIsOccurrenceCache?;
139
+ private yearlyDaysNeverMatchCache?;
139
140
  private static readonly rscaleCalendarSupport;
140
141
  /**
141
142
  * Normalize a ZonedDateTime to the polyfill implementation.
@@ -175,6 +176,12 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
175
176
  private needsSortedTimeFallback;
176
177
  private createCandidateWorkBudget;
177
178
  private recordCandidateEvaluation;
179
+ /**
180
+ * Charge a fast path's dates to the budget, as the general engine charges
181
+ * each candidate. A DTSTART that includeDtstart added is not a candidate.
182
+ */
183
+ private assertFastPathBudget;
184
+ private assertCandidateBudget;
178
185
  /**
179
186
  * Visit BYHOUR x BYMINUTE x BYSECOND without allocating the Cartesian
180
187
  * product. Returning false from `visit` terminates the innermost traversal
@@ -234,6 +241,15 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
234
241
  * without incorrectly judging the rule from DTSTART's year alone.
235
242
  */
236
243
  private hasPossibleYearDayWeekNoCombination;
244
+ /**
245
+ * BYDAY and BYMONTHDAY limit the days that a YEARLY rule gets from BYYEARDAY, or from an ordinal BYDAY
246
+ * counted over the year, so they can leave no day in any year (`BYYEARDAY=1;BYMONTHDAY=2`). Gregorian
247
+ * weekdays and leap years repeat every 400 years, so scanning 400 recurrence years decides it and the
248
+ * search can stop instead of running into maxIterations. A DTSTART in another calendar (for example
249
+ * `[u-ca=hebrew]`) counts its years in that calendar, whose years do not repeat that way, so the
250
+ * shortcut is left to the Gregorian calendar.
251
+ */
252
+ private yearlyDaysNeverMatch;
237
253
  options(): RRuleResolvedOptions<TOutput>;
238
254
  private cloneOptions;
239
255
  private cloneUpdateOptions;
@@ -270,6 +286,28 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
270
286
  private buildDailyNumericQueryPlan;
271
287
  private buildWeeklyNumericQueryPlan;
272
288
  private buildMonthlyNumericQueryPlan;
289
+ /**
290
+ * A MONTHLY or YEARLY period's candidates, sorted(days x time slots) and then
291
+ * narrowed by BYSETPOS, described by its day list alone. Days and slots are
292
+ * ascending and unique, and a slot is shorter than a day, so candidate k is
293
+ * day floor(k / S) at slot k % S, and BYSETPOS keeps the ascending, distinct
294
+ * indices it names. Null when the day list breaks that order.
295
+ */
296
+ private numericPeriodShape;
297
+ private numericPeriodWall;
298
+ /**
299
+ * Index of the first of a first period's ascending candidates at or after
300
+ * DTSTART, or null when one does not resolve or the kept ones are not a
301
+ * suffix. Every candidate is resolved, as when they were materialized.
302
+ */
303
+ private numericFirstPeriodSkip;
304
+ /**
305
+ * Rank/select over MONTHLY or YEARLY periods. A cached plan holds the first
306
+ * period's day list, a skip offset into it, per-period counts over at most
307
+ * one calendar cycle and the last selected period's day list, never a
308
+ * period's candidates.
309
+ */
310
+ private buildCalendarNumericQueryPlan;
273
311
  /**
274
312
  * Build one Gregorian recurrence year's matching epoch days, without time
275
313
  * expansion. This deliberately covers the common YEARLY shapes
@@ -277,7 +315,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
277
315
  */
278
316
  private generateYearlyOccurrenceDaysUtc;
279
317
  private generateYearlyOccurrenceEpochsUtc;
280
- private yearlyCandidateEvaluationCountUtc;
318
+ private yearlyCandidateEvaluationCount;
281
319
  private buildYearlyNumericQueryPlan;
282
320
  private buildNumericQueryPlan;
283
321
  private getNumericQueryPlan;
@@ -288,6 +326,8 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
288
326
  private buildPeriodQueryPlan;
289
327
  private getPeriodQueryPlan;
290
328
  private findFirstMatchingDailyStep;
329
+ /** First instant an expanded path has to build: DTSTART, or the query's lower bound once it's later. */
330
+ private firstExpandedEpochMs;
291
331
  private allUtcFastPath;
292
332
  private _allUtcFixedStepSimple;
293
333
  private _allUtcDailySimple;
@@ -521,6 +561,12 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
521
561
  * callers consume the date x time product incrementally.
522
562
  */
523
563
  private generateYearlyDateCandidates;
564
+ /**
565
+ * BYDAY as a limit on a date of a YEARLY rule. An ordinal weekday counts
566
+ * within the month when BYMONTH is given and within the year otherwise,
567
+ * the same way the weekdays are generated.
568
+ */
569
+ private matchesYearlyByDay;
524
570
  private addByDayDates;
525
571
  /**
526
572
  * Helper to find the next valid value from a sorted array
package/dist/index.d.ts CHANGED
@@ -136,6 +136,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
136
136
  private numericQueryPlanCache;
137
137
  private periodQueryPlanCache;
138
138
  private dtstartIsOccurrenceCache?;
139
+ private yearlyDaysNeverMatchCache?;
139
140
  private static readonly rscaleCalendarSupport;
140
141
  /**
141
142
  * Normalize a ZonedDateTime to the polyfill implementation.
@@ -175,6 +176,12 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
175
176
  private needsSortedTimeFallback;
176
177
  private createCandidateWorkBudget;
177
178
  private recordCandidateEvaluation;
179
+ /**
180
+ * Charge a fast path's dates to the budget, as the general engine charges
181
+ * each candidate. A DTSTART that includeDtstart added is not a candidate.
182
+ */
183
+ private assertFastPathBudget;
184
+ private assertCandidateBudget;
178
185
  /**
179
186
  * Visit BYHOUR x BYMINUTE x BYSECOND without allocating the Cartesian
180
187
  * product. Returning false from `visit` terminates the innermost traversal
@@ -234,6 +241,15 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
234
241
  * without incorrectly judging the rule from DTSTART's year alone.
235
242
  */
236
243
  private hasPossibleYearDayWeekNoCombination;
244
+ /**
245
+ * BYDAY and BYMONTHDAY limit the days that a YEARLY rule gets from BYYEARDAY, or from an ordinal BYDAY
246
+ * counted over the year, so they can leave no day in any year (`BYYEARDAY=1;BYMONTHDAY=2`). Gregorian
247
+ * weekdays and leap years repeat every 400 years, so scanning 400 recurrence years decides it and the
248
+ * search can stop instead of running into maxIterations. A DTSTART in another calendar (for example
249
+ * `[u-ca=hebrew]`) counts its years in that calendar, whose years do not repeat that way, so the
250
+ * shortcut is left to the Gregorian calendar.
251
+ */
252
+ private yearlyDaysNeverMatch;
237
253
  options(): RRuleResolvedOptions<TOutput>;
238
254
  private cloneOptions;
239
255
  private cloneUpdateOptions;
@@ -270,6 +286,28 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
270
286
  private buildDailyNumericQueryPlan;
271
287
  private buildWeeklyNumericQueryPlan;
272
288
  private buildMonthlyNumericQueryPlan;
289
+ /**
290
+ * A MONTHLY or YEARLY period's candidates, sorted(days x time slots) and then
291
+ * narrowed by BYSETPOS, described by its day list alone. Days and slots are
292
+ * ascending and unique, and a slot is shorter than a day, so candidate k is
293
+ * day floor(k / S) at slot k % S, and BYSETPOS keeps the ascending, distinct
294
+ * indices it names. Null when the day list breaks that order.
295
+ */
296
+ private numericPeriodShape;
297
+ private numericPeriodWall;
298
+ /**
299
+ * Index of the first of a first period's ascending candidates at or after
300
+ * DTSTART, or null when one does not resolve or the kept ones are not a
301
+ * suffix. Every candidate is resolved, as when they were materialized.
302
+ */
303
+ private numericFirstPeriodSkip;
304
+ /**
305
+ * Rank/select over MONTHLY or YEARLY periods. A cached plan holds the first
306
+ * period's day list, a skip offset into it, per-period counts over at most
307
+ * one calendar cycle and the last selected period's day list, never a
308
+ * period's candidates.
309
+ */
310
+ private buildCalendarNumericQueryPlan;
273
311
  /**
274
312
  * Build one Gregorian recurrence year's matching epoch days, without time
275
313
  * expansion. This deliberately covers the common YEARLY shapes
@@ -277,7 +315,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
277
315
  */
278
316
  private generateYearlyOccurrenceDaysUtc;
279
317
  private generateYearlyOccurrenceEpochsUtc;
280
- private yearlyCandidateEvaluationCountUtc;
318
+ private yearlyCandidateEvaluationCount;
281
319
  private buildYearlyNumericQueryPlan;
282
320
  private buildNumericQueryPlan;
283
321
  private getNumericQueryPlan;
@@ -288,6 +326,8 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
288
326
  private buildPeriodQueryPlan;
289
327
  private getPeriodQueryPlan;
290
328
  private findFirstMatchingDailyStep;
329
+ /** First instant an expanded path has to build: DTSTART, or the query's lower bound once it's later. */
330
+ private firstExpandedEpochMs;
291
331
  private allUtcFastPath;
292
332
  private _allUtcFixedStepSimple;
293
333
  private _allUtcDailySimple;
@@ -521,6 +561,12 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
521
561
  * callers consume the date x time product incrementally.
522
562
  */
523
563
  private generateYearlyDateCandidates;
564
+ /**
565
+ * BYDAY as a limit on a date of a YEARLY rule. An ordinal weekday counts
566
+ * within the month when BYMONTH is given and within the year otherwise,
567
+ * the same way the weekdays are generated.
568
+ */
569
+ private matchesYearlyByDay;
524
570
  private addByDayDates;
525
571
  /**
526
572
  * Helper to find the next valid value from a sorted array
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{i as e,n as t,r as n,t as r}from"./src-vjCiI_-u.js";export{r as RRuleTemporal,t as allowedFreq,n as allowedWeekdays,e as weekdayToIsoDay};
1
+ import{i as e,n as t,r as n,t as r}from"./src-DOMrjyRf.js";export{r as RRuleTemporal,t as allowedFreq,n as allowedWeekdays,e as weekdayToIsoDay};