rrule-temporal 2.0.3 → 2.2.0

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
@@ -114,6 +114,7 @@ below. These correspond to the recurrence rule parts defined in RFC 5545:
114
114
  | `maxIterations` | Safety cap when generating occurrences. |
115
115
  | `includeDtstart` | Include `DTSTART` even if it does not match the pattern. |
116
116
  | `strict` | Enforce RFC 5545 constraints strictly (defaults to false). |
117
+ | `temporal` | Optional Temporal namespace used for public output values and their inferred types. |
117
118
  | `dtstart` | First occurrence as `Temporal.ZonedDateTime`. |
118
119
 
119
120
  ### Reusable Option Lists
@@ -303,35 +304,57 @@ Notes
303
304
 
304
305
  ## Benchmarks
305
306
 
306
- Uncached median ops/s from the benchmark suite on a MacBook Pro M2 Max
307
- (Node 25, polyfill backend). The full three-library comparison, including
308
- `rrule-rust` and cached-mode results, lives in `benchmarks/README.md`.
307
+ COUNT-bound query results from a MacBook Pro M2 Max / Node 25 run, comparing
308
+ `v2.0.3` with the `v2.1.0` candidate. Times are milliseconds per call; both
309
+ builds used the same harness and result checksum.
310
+
311
+ | Scenario | v2.0.3 first | v2.1.0 first | First speedup | v2.0.3 warm | v2.1.0 warm | Warm speedup |
312
+ | --- | ---: | ---: | ---: | ---: | ---: | ---: |
313
+ | SECONDLY next, COUNT 128, rank 63 | 3.10 | 0.584 | 5.3x | 0.242 | 0.00951 | 25.5x |
314
+ | SECONDLY next, COUNT 250k, rank 200k | 886.0 | 0.137 | 6,481x | 806.3 | 0.00950 | 84,874x |
315
+ | DAILY next, COUNT 9k, rank 8.5k, UTC | 50.6 | 0.291 | 174x | 47.6 | 0.00984 | 4,837x |
316
+ | DAILY previous, COUNT 9k, rank 8.5k, Chicago | 60.2 | 7.59 | 7.9x | 53.4 | 0.01250 | 4,272x |
317
+ | DAILY weekdays next, COUNT 9k, distant, UTC | 68.7 | 0.0895 | 768x | 61.4 | 0.01010 | 6,079x |
318
+ | DAILY slots narrow between, COUNT 9k, UTC | 32.6 | 0.326 | 100x | 30.4 | 0.03466 | 877x |
319
+ | WEEKLY M/W/F slots next, COUNT 9k, UTC | 122.5 | 0.353 | 347x | 81.8 | 0.01037 | 7,888x |
320
+ | MONTHLY last weekday next, COUNT 9k, UTC | 197.8 | 8.54 | 23.2x | 186.3 | 0.03191 | 5,838x |
321
+ | MONTHLY last weekday next, COUNT 128, rank 63 | 1.49 | 0.321 | 4.6x | 1.40 | 0.02155 | 65.0x |
322
+
323
+ The named-zone first call includes lazy transition-table construction. Its
324
+ warmed path reuses both that table and the immutable rule's numeric query plan.
325
+
326
+ ### Full recurrence generation
327
+
328
+ Uncached median ops/s for `rrule-temporal` v2.1.0 on a MacBook Pro M2 Max
329
+ (Node 25, polyfill backend). Each result is the median of five 200 ms samples
330
+ after a 200 ms warmup. The three-library comparison, query methodology, and
331
+ cached-mode summary live in [`benchmarks/README.md`](benchmarks/README.md).
309
332
 
310
333
  | Scenario | TZ | rrule-temporal median ops/s | rrule median ops/s | vs rrule |
311
334
  | --- | --- | ---: | ---: | ---: |
312
- | 30 daily occurrences | UTC | 22,308 | 17,932 | 1.24x |
313
- | 30 daily occurrences | America/Chicago | 15,358 | 384 | 40.00x |
314
- | Daily weekdays across many cycles | UTC | 1,192 | 830 | 1.44x |
315
- | Daily weekdays across many cycles | America/Chicago | 873 | 20.9 | 41.77x |
316
- | Daily time-slot expansion | UTC | 611 | 1,199 | 0.51x |
317
- | Daily time-slot expansion | America/Chicago | 448 | 11.7 | 38.29x |
318
- | 720 hourly occurrences | UTC | 817 | 757 | 1.08x |
319
- | 720 hourly occurrences | America/Chicago | 588 | 13.9 | 42.30x |
320
- | 1,440 minutely occurrences | UTC | 392 | 364 | 1.08x |
321
- | 1,440 minutely occurrences | America/Chicago | 287 | 7.4 | 38.78x |
322
- | 3,600 secondly occurrences | UTC | 152 | 144 | 1.06x |
323
- | 3,600 secondly occurrences | America/Chicago | 113 | 2.9 | 38.97x |
324
- | Weekly MO/WE/FR across many cycles | UTC | 662 | 1,137 | 0.58x |
325
- | Weekly MO/WE/FR across many cycles | America/Chicago | 493 | 14.7 | 33.54x |
326
- | Weekly day and time-slot expansion | UTC | 502 | 1,207 | 0.42x |
327
- | Weekly day and time-slot expansion | America/Chicago | 394 | 12.2 | 32.30x |
328
- | Monthly last weekday across 20 years | UTC | 1,314 | 1,119 | 1.17x |
329
- | Monthly last weekday across 20 years | America/Chicago | 1,043 | 41.7 | 25.01x |
330
- | Monthly first and last weekday across 20 years | UTC | 804 | 1,326 | 0.61x |
331
- | Monthly first and last weekday across 20 years | America/Chicago | 622 | 24.9 | 24.98x |
335
+ | 30 daily occurrences | UTC | 18,847 | 14,581 | 1.29x |
336
+ | 30 daily occurrences | America/Chicago | 12,796 | 328 | 39.01x |
337
+ | Daily weekdays across many cycles | UTC | 961 | 713 | 1.35x |
338
+ | Daily weekdays across many cycles | America/Chicago | 723 | 18.4 | 39.29x |
339
+ | Daily time-slot expansion | UTC | 488 | 1,006 | 0.49x |
340
+ | Daily time-slot expansion | America/Chicago | 371 | 10.7 | 34.67x |
341
+ | 720 hourly occurrences | UTC | 685 | 723 | 0.95x |
342
+ | 720 hourly occurrences | America/Chicago | 491 | 13.2 | 37.20x |
343
+ | 1,440 minutely occurrences | UTC | 326 | 332 | 0.98x |
344
+ | 1,440 minutely occurrences | America/Chicago | 245 | 6.8 | 36.03x |
345
+ | 3,600 secondly occurrences | UTC | 121 | 130 | 0.93x |
346
+ | 3,600 secondly occurrences | America/Chicago | 101 | 2.8 | 36.07x |
347
+ | Weekly MO/WE/FR across many cycles | UTC | 538 | 1,126 | 0.48x |
348
+ | Weekly MO/WE/FR across many cycles | America/Chicago | 418 | 13.8 | 30.29x |
349
+ | Weekly day and time-slot expansion | UTC | 426 | 1,197 | 0.36x |
350
+ | Weekly day and time-slot expansion | America/Chicago | 343 | 11.7 | 29.32x |
351
+ | Monthly last weekday across 20 years | UTC | 1,114 | 1,146 | 0.97x |
352
+ | Monthly last weekday across 20 years | America/Chicago | 921 | 43.5 | 21.17x |
353
+ | Monthly first and last weekday across 20 years | UTC | 664 | 1,287 | 0.52x |
354
+ | Monthly first and last weekday across 20 years | America/Chicago | 553 | 23.4 | 23.63x |
332
355
 
333
356
  Time-zone-aware rules iterate through an epoch-integer engine with a cached
334
- per-zone offset table, so named-zone scenarios now run 25–42x faster than
357
+ per-zone offset table, so named-zone scenarios now run 21–39x faster than
335
358
  `rrule` and within a small factor of their UTC equivalents. On UTC the two
336
359
  libraries are comparable on Node 25 (`rrule` stays ahead in several expanded
337
360
  and weekly/monthly scenarios where occurrence materialization dominates); on
@@ -406,30 +429,43 @@ Inputs are accepted from **any** Temporal implementation: `dtstart`, `until`,
406
429
  objects from `@js-temporal/polyfill`, `temporal-polyfill`, or native Temporal
407
430
  interchangeably.
408
431
 
409
- Returned occurrences come from the library's active implementation (native
410
- when available, the bundled polyfill otherwise). They are fully spec-shaped,
411
- but they will not satisfy `instanceof` checks against a *different*
412
- implementation's classes. If your app needs instances of its own Temporal
413
- implementation, re-hydrate them:
432
+ By default, returned occurrences come from the library's active implementation
433
+ (native when available, the bundled polyfill otherwise) and use
434
+ implementation-neutral `temporal-spec` types. To return instances from your
435
+ application's Temporal implementation with its exact inferred TypeScript
436
+ types, pass the optional `temporal` namespace:
414
437
 
415
438
  ```ts
416
- // your application's Temporal implementation
417
- import { Temporal as AppTemporal } from "temporal-polyfill";
418
-
439
+ import { Temporal } from "@js-temporal/polyfill";
419
440
  import { RRuleTemporal } from "rrule-temporal";
420
441
 
421
- /** Weekly rule that fires 4 times starting 5 May 2025, 10 AM America/Chicago. */
422
442
  const rule = new RRuleTemporal({
443
+ temporal: Temporal,
423
444
  freq: "WEEKLY",
424
445
  count: 4,
425
- dtstart: AppTemporal.ZonedDateTime.from(
426
- "2025-05-05T10:00[America/Chicago]"
446
+ dtstart: Temporal.ZonedDateTime.from(
447
+ "2030-05-05T10:00[America/Chicago]"
427
448
  ),
428
449
  });
429
450
 
430
- const rawOccurrences = rule.all();
451
+ const occurrence = rule.next(); // Temporal.ZonedDateTime | null
452
+ const date = occurrence?.toPlainDate(); // Temporal.PlainDate | undefined
453
+ ```
454
+
455
+ The selected implementation is used for values returned by `all()`,
456
+ `between()`, `next()`, `previous()`, iterator callbacks, `options()`, and
457
+ rules created with `with()`. Recurrence calculations still use the optimized
458
+ active implementation internally. Omitting `temporal` preserves the default
459
+ behavior.
460
+
461
+ Returned values from different implementations are fully spec-shaped but do
462
+ not satisfy `instanceof` checks against each other's classes. If a rule was
463
+ created without `temporal`, you can still re-hydrate individual results:
464
+
465
+ ```ts
466
+ import { Temporal as AppTemporal } from "@js-temporal/polyfill";
431
467
 
432
- /** Convert each ZonedDateTime into your app's implementation. */
468
+ const rawOccurrences = existingRule.all();
433
469
  const appOccurrences = rawOccurrences.map((zdt) =>
434
470
  AppTemporal.ZonedDateTime.from(zdt.toString())
435
471
  );
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_src = require("./src-DmTIBKXY.cjs");
2
+ const require_src = require("./src-C6VoiyAb.cjs");
3
3
  exports.RRuleTemporal = require_src.RRuleTemporal;
4
4
  exports.allowedFreq = require_src.allowedFreq;
5
5
  exports.allowedWeekdays = require_src.allowedWeekdays;
package/dist/index.d.cts CHANGED
@@ -9,7 +9,9 @@ declare const weekdayToIsoDay: Record<Weekday, number>;
9
9
  /**
10
10
  * Shared options for all rule constructors.
11
11
  */
12
- interface BaseOpts {
12
+ interface BaseOpts<TOutput extends TemporalZonedDateTimeInput = TemporalZonedDateTime> {
13
+ /** Temporal implementation used to construct public occurrence values. */
14
+ temporal?: TemporalImplementation<TOutput>;
13
15
  /** Time zone identifier as defined in RFC&nbsp;5545 §3.2.19. */
14
16
  tzid?: string;
15
17
  /** Safety cap when generating occurrences. */
@@ -34,13 +36,23 @@ interface TemporalZonedDateTimeInput {
34
36
  interface TemporalPlainDateInput {
35
37
  toString(): string;
36
38
  }
37
- type RRuleTemporalIterator = (date: TemporalZonedDateTime, i: number) => boolean;
39
+ /**
40
+ * The subset of a Temporal namespace needed to construct public occurrence
41
+ * values. Supplying an implementation makes output values and their inferred
42
+ * TypeScript types come from that implementation.
43
+ */
44
+ interface TemporalImplementation<TOutput extends TemporalZonedDateTimeInput = TemporalZonedDateTime> {
45
+ readonly ZonedDateTime: {
46
+ from(value: string): TOutput;
47
+ };
48
+ }
49
+ type RRuleTemporalIterator<TOutput extends TemporalZonedDateTimeInput = TemporalZonedDateTime> = (date: TOutput, i: number) => boolean;
38
50
  type DateFilter = Date | TemporalZonedDateTimeInput;
39
51
  /**
40
52
  * Manual rule definition following the recurrence rule parts defined in
41
53
  * RFC 5545 §3.3.10.
42
54
  */
43
- interface ManualOptions extends BaseOpts {
55
+ interface ManualOptions<TOutput extends TemporalZonedDateTimeInput = TemporalZonedDateTime> extends BaseOpts<TOutput> {
44
56
  /** FREQ: recurrence frequency */
45
57
  freq: Freq;
46
58
  /** INTERVAL between each occurrence of {@link freq} */
@@ -76,7 +88,7 @@ interface ManualOptions extends BaseOpts {
76
88
  /** DTSTART: first occurrence */
77
89
  dtstart: TemporalZonedDateTimeInput;
78
90
  }
79
- interface IcsOptions extends BaseOpts {
91
+ interface IcsOptions<TOutput extends TemporalZonedDateTimeInput = TemporalZonedDateTime> extends BaseOpts<TOutput> {
80
92
  rruleString: string;
81
93
  dtstart?: TemporalZonedDateTimeInput;
82
94
  /** COUNT: total number of occurrences, used when missing from rruleString */
@@ -88,17 +100,18 @@ interface IcsOptions extends BaseOpts {
88
100
  /** EXDATE: exception dates to exclude */
89
101
  exDate?: TemporalZonedDateTimeInput[];
90
102
  }
91
- type RRuleOptions = ManualOptions | IcsOptions;
92
- type RRuleResolvedOptions = Omit<ManualOptions, 'dtstart' | 'until' | 'rDate' | 'exDate'> & {
93
- dtstart: TemporalZonedDateTime;
94
- until?: TemporalZonedDateTime;
95
- rDate?: TemporalZonedDateTime[];
96
- exDate?: TemporalZonedDateTime[];
103
+ type RRuleOptions<TOutput extends TemporalZonedDateTimeInput = TemporalZonedDateTime> = ManualOptions<TOutput> | IcsOptions<TOutput>;
104
+ type RRuleResolvedOptions<TOutput extends TemporalZonedDateTimeInput = TemporalZonedDateTime> = Omit<ManualOptions<TOutput>, 'dtstart' | 'until' | 'rDate' | 'exDate'> & {
105
+ dtstart: TOutput;
106
+ until?: TOutput;
107
+ rDate?: TOutput[];
108
+ exDate?: TOutput[];
97
109
  };
98
- declare class RRuleTemporal {
110
+ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = TemporalZonedDateTime> {
99
111
  private readonly tzid;
100
112
  private readonly originalDtstart;
101
113
  private readonly opts;
114
+ private readonly outputTemporal?;
102
115
  private readonly maxIterations;
103
116
  private readonly includeDtstart;
104
117
  private readonly parsedByDayTokens?;
@@ -113,16 +126,17 @@ declare class RRuleTemporal {
113
126
  private allResultCache?;
114
127
  private zoneResolver?;
115
128
  private emitAnchorZdt?;
129
+ private numericQueryPlanCache;
116
130
  private static readonly rscaleCalendarSupport;
117
131
  /**
118
132
  * Normalize a ZonedDateTime to the polyfill implementation.
119
133
  * This prevents type mismatches when mixing native and polyfill Temporal objects.
120
134
  */
121
135
  private static normalizeToPolyfill;
122
- private static toInternalIterator;
123
- private static toPublicDate;
124
- private static toPublicDates;
125
- constructor(params: RRuleOptions);
136
+ private toInternalIterator;
137
+ private toPublicDate;
138
+ private toPublicDates;
139
+ constructor(params: RRuleOptions<TOutput>);
126
140
  private buildParsedByDayTokens;
127
141
  private buildByDayIsoDays;
128
142
  private sanitizeNumericArray;
@@ -149,7 +163,7 @@ declare class RRuleTemporal {
149
163
  private matchesByYearDay;
150
164
  private getIsoWeekInfo;
151
165
  private matchesByWeekNo;
152
- options(): RRuleResolvedOptions;
166
+ options(): RRuleResolvedOptions<TOutput>;
153
167
  private cloneOptions;
154
168
  private cloneUpdateOptions;
155
169
  /**
@@ -160,7 +174,7 @@ declare class RRuleTemporal {
160
174
  * const updated = rule.with({byMonthDay: [3]});
161
175
  * ```
162
176
  */
163
- with(updates: Partial<ManualOptions>): RRuleTemporal;
177
+ with(updates: Partial<ManualOptions<TOutput>>): RRuleTemporal<TOutput>;
164
178
  private addDtstartIfNeeded;
165
179
  private canUseUtcLinearFastPath;
166
180
  private canUseUtcWeeklyFastPath;
@@ -169,6 +183,15 @@ declare class RRuleTemporal {
169
183
  private utcZdtFromEpochMilliseconds;
170
184
  private canUseUtcEpochMillisecondsPrecision;
171
185
  private buildTimeSlotOffsetsMs;
186
+ private createNumericQueryPlan;
187
+ private buildFixedStepNumericQueryPlan;
188
+ private resolveNumericWallMilliseconds;
189
+ private numericQueryGapHazard;
190
+ private buildDailyNumericQueryPlan;
191
+ private buildWeeklyNumericQueryPlan;
192
+ private buildMonthlyNumericQueryPlan;
193
+ private buildNumericQueryPlan;
194
+ private getNumericQueryPlan;
172
195
  private findFirstMatchingDailyStep;
173
196
  private allUtcFastPath;
174
197
  private _allUtcFixedStepSimple;
@@ -228,7 +251,7 @@ declare class RRuleTemporal {
228
251
  * @param iterator - An optional callback iterator function that can be used to filter or modify the occurrences.
229
252
  * @returns An array of Temporal.ZonedDateTime objects representing all occurrences of the rule.
230
253
  */
231
- all(iterator?: RRuleTemporalIterator): TemporalZonedDateTime[];
254
+ all(iterator?: RRuleTemporalIterator<TOutput>): TOutput[];
232
255
  private allInternal;
233
256
  /**
234
257
  * RFC 7529: RSCALE present, simple monthly iteration with SKIP behavior.
@@ -272,6 +295,11 @@ declare class RRuleTemporal {
272
295
  /** Stops RRULE generation once COUNT rule occurrences have been found. */
273
296
  private shouldBreakForCountLimit;
274
297
  private hasTimeOfDayBetween;
298
+ private assertNumericCandidateReachable;
299
+ private numericExhaustionCandidate;
300
+ private tryNumericNext;
301
+ private tryNumericPrevious;
302
+ private tryNumericBetween;
275
303
  /**
276
304
  * Returns all occurrences of the rule within a specified time window.
277
305
  * @param after - The start date or Temporal.ZonedDateTime object.
@@ -279,7 +307,7 @@ declare class RRuleTemporal {
279
307
  * @param inc - Optional boolean flag to include the start and end dates in the results.
280
308
  * @returns An array of Temporal.ZonedDateTime objects representing all occurrences of the rule within the specified time window.
281
309
  */
282
- between(after: DateFilter, before: DateFilter, inc?: boolean): TemporalZonedDateTime[];
310
+ between(after: DateFilter, before: DateFilter, inc?: boolean): TOutput[];
283
311
  /**
284
312
  * Compute a rule-phase-aligned DTSTART at or just before the given window
285
313
  * start, jumping forward from the original DTSTART in whole multiples of
@@ -304,7 +332,7 @@ declare class RRuleTemporal {
304
332
  * @param inc - Optional boolean flag to include occurrences on the start date.
305
333
  * @returns The next occurrence of the rule after the specified date or null if no occurrences are found.
306
334
  */
307
- next(after?: DateFilter, inc?: boolean): TemporalZonedDateTime | null;
335
+ next(after?: DateFilter, inc?: boolean): TOutput | null;
308
336
  /**
309
337
  * Build a temporary rule identical to this one but starting at the
310
338
  * phase-aligned DTSTART for the given window start. The synthetic DTSTART
@@ -317,7 +345,7 @@ declare class RRuleTemporal {
317
345
  * @param inc - Optional boolean flag to include occurrences on the end date.
318
346
  * @returns The previous occurrence of the rule before the specified date or null if no occurrences are found.
319
347
  */
320
- previous(before?: DateFilter, inc?: boolean): TemporalZonedDateTime | null;
348
+ previous(before?: DateFilter, inc?: boolean): TOutput | null;
321
349
  /** A duration of `count` steps in this rule's frequency unit. */
322
350
  private freqDuration;
323
351
  toString(): string;
@@ -374,4 +402,4 @@ declare class RRuleTemporal {
374
402
  private _allRscaleNonGregorian;
375
403
  }
376
404
  //#endregion
377
- export { DateFilter, Freq, RRuleOptions, RRuleResolvedOptions, RRuleTemporal, RRuleTemporalIterator, TemporalPlainDate, TemporalPlainDateInput, TemporalZonedDateTime, TemporalZonedDateTimeInput, Weekday, allowedFreq, allowedWeekdays, weekdayToIsoDay };
405
+ export { DateFilter, Freq, RRuleOptions, RRuleResolvedOptions, RRuleTemporal, RRuleTemporalIterator, TemporalImplementation, TemporalPlainDate, TemporalPlainDateInput, TemporalZonedDateTime, TemporalZonedDateTimeInput, Weekday, allowedFreq, allowedWeekdays, weekdayToIsoDay };
package/dist/index.d.ts CHANGED
@@ -9,7 +9,9 @@ declare const weekdayToIsoDay: Record<Weekday, number>;
9
9
  /**
10
10
  * Shared options for all rule constructors.
11
11
  */
12
- interface BaseOpts {
12
+ interface BaseOpts<TOutput extends TemporalZonedDateTimeInput = TemporalZonedDateTime> {
13
+ /** Temporal implementation used to construct public occurrence values. */
14
+ temporal?: TemporalImplementation<TOutput>;
13
15
  /** Time zone identifier as defined in RFC&nbsp;5545 §3.2.19. */
14
16
  tzid?: string;
15
17
  /** Safety cap when generating occurrences. */
@@ -34,13 +36,23 @@ interface TemporalZonedDateTimeInput {
34
36
  interface TemporalPlainDateInput {
35
37
  toString(): string;
36
38
  }
37
- type RRuleTemporalIterator = (date: TemporalZonedDateTime, i: number) => boolean;
39
+ /**
40
+ * The subset of a Temporal namespace needed to construct public occurrence
41
+ * values. Supplying an implementation makes output values and their inferred
42
+ * TypeScript types come from that implementation.
43
+ */
44
+ interface TemporalImplementation<TOutput extends TemporalZonedDateTimeInput = TemporalZonedDateTime> {
45
+ readonly ZonedDateTime: {
46
+ from(value: string): TOutput;
47
+ };
48
+ }
49
+ type RRuleTemporalIterator<TOutput extends TemporalZonedDateTimeInput = TemporalZonedDateTime> = (date: TOutput, i: number) => boolean;
38
50
  type DateFilter = Date | TemporalZonedDateTimeInput;
39
51
  /**
40
52
  * Manual rule definition following the recurrence rule parts defined in
41
53
  * RFC 5545 §3.3.10.
42
54
  */
43
- interface ManualOptions extends BaseOpts {
55
+ interface ManualOptions<TOutput extends TemporalZonedDateTimeInput = TemporalZonedDateTime> extends BaseOpts<TOutput> {
44
56
  /** FREQ: recurrence frequency */
45
57
  freq: Freq;
46
58
  /** INTERVAL between each occurrence of {@link freq} */
@@ -76,7 +88,7 @@ interface ManualOptions extends BaseOpts {
76
88
  /** DTSTART: first occurrence */
77
89
  dtstart: TemporalZonedDateTimeInput;
78
90
  }
79
- interface IcsOptions extends BaseOpts {
91
+ interface IcsOptions<TOutput extends TemporalZonedDateTimeInput = TemporalZonedDateTime> extends BaseOpts<TOutput> {
80
92
  rruleString: string;
81
93
  dtstart?: TemporalZonedDateTimeInput;
82
94
  /** COUNT: total number of occurrences, used when missing from rruleString */
@@ -88,17 +100,18 @@ interface IcsOptions extends BaseOpts {
88
100
  /** EXDATE: exception dates to exclude */
89
101
  exDate?: TemporalZonedDateTimeInput[];
90
102
  }
91
- type RRuleOptions = ManualOptions | IcsOptions;
92
- type RRuleResolvedOptions = Omit<ManualOptions, 'dtstart' | 'until' | 'rDate' | 'exDate'> & {
93
- dtstart: TemporalZonedDateTime;
94
- until?: TemporalZonedDateTime;
95
- rDate?: TemporalZonedDateTime[];
96
- exDate?: TemporalZonedDateTime[];
103
+ type RRuleOptions<TOutput extends TemporalZonedDateTimeInput = TemporalZonedDateTime> = ManualOptions<TOutput> | IcsOptions<TOutput>;
104
+ type RRuleResolvedOptions<TOutput extends TemporalZonedDateTimeInput = TemporalZonedDateTime> = Omit<ManualOptions<TOutput>, 'dtstart' | 'until' | 'rDate' | 'exDate'> & {
105
+ dtstart: TOutput;
106
+ until?: TOutput;
107
+ rDate?: TOutput[];
108
+ exDate?: TOutput[];
97
109
  };
98
- declare class RRuleTemporal {
110
+ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = TemporalZonedDateTime> {
99
111
  private readonly tzid;
100
112
  private readonly originalDtstart;
101
113
  private readonly opts;
114
+ private readonly outputTemporal?;
102
115
  private readonly maxIterations;
103
116
  private readonly includeDtstart;
104
117
  private readonly parsedByDayTokens?;
@@ -113,16 +126,17 @@ declare class RRuleTemporal {
113
126
  private allResultCache?;
114
127
  private zoneResolver?;
115
128
  private emitAnchorZdt?;
129
+ private numericQueryPlanCache;
116
130
  private static readonly rscaleCalendarSupport;
117
131
  /**
118
132
  * Normalize a ZonedDateTime to the polyfill implementation.
119
133
  * This prevents type mismatches when mixing native and polyfill Temporal objects.
120
134
  */
121
135
  private static normalizeToPolyfill;
122
- private static toInternalIterator;
123
- private static toPublicDate;
124
- private static toPublicDates;
125
- constructor(params: RRuleOptions);
136
+ private toInternalIterator;
137
+ private toPublicDate;
138
+ private toPublicDates;
139
+ constructor(params: RRuleOptions<TOutput>);
126
140
  private buildParsedByDayTokens;
127
141
  private buildByDayIsoDays;
128
142
  private sanitizeNumericArray;
@@ -149,7 +163,7 @@ declare class RRuleTemporal {
149
163
  private matchesByYearDay;
150
164
  private getIsoWeekInfo;
151
165
  private matchesByWeekNo;
152
- options(): RRuleResolvedOptions;
166
+ options(): RRuleResolvedOptions<TOutput>;
153
167
  private cloneOptions;
154
168
  private cloneUpdateOptions;
155
169
  /**
@@ -160,7 +174,7 @@ declare class RRuleTemporal {
160
174
  * const updated = rule.with({byMonthDay: [3]});
161
175
  * ```
162
176
  */
163
- with(updates: Partial<ManualOptions>): RRuleTemporal;
177
+ with(updates: Partial<ManualOptions<TOutput>>): RRuleTemporal<TOutput>;
164
178
  private addDtstartIfNeeded;
165
179
  private canUseUtcLinearFastPath;
166
180
  private canUseUtcWeeklyFastPath;
@@ -169,6 +183,15 @@ declare class RRuleTemporal {
169
183
  private utcZdtFromEpochMilliseconds;
170
184
  private canUseUtcEpochMillisecondsPrecision;
171
185
  private buildTimeSlotOffsetsMs;
186
+ private createNumericQueryPlan;
187
+ private buildFixedStepNumericQueryPlan;
188
+ private resolveNumericWallMilliseconds;
189
+ private numericQueryGapHazard;
190
+ private buildDailyNumericQueryPlan;
191
+ private buildWeeklyNumericQueryPlan;
192
+ private buildMonthlyNumericQueryPlan;
193
+ private buildNumericQueryPlan;
194
+ private getNumericQueryPlan;
172
195
  private findFirstMatchingDailyStep;
173
196
  private allUtcFastPath;
174
197
  private _allUtcFixedStepSimple;
@@ -228,7 +251,7 @@ declare class RRuleTemporal {
228
251
  * @param iterator - An optional callback iterator function that can be used to filter or modify the occurrences.
229
252
  * @returns An array of Temporal.ZonedDateTime objects representing all occurrences of the rule.
230
253
  */
231
- all(iterator?: RRuleTemporalIterator): TemporalZonedDateTime[];
254
+ all(iterator?: RRuleTemporalIterator<TOutput>): TOutput[];
232
255
  private allInternal;
233
256
  /**
234
257
  * RFC 7529: RSCALE present, simple monthly iteration with SKIP behavior.
@@ -272,6 +295,11 @@ declare class RRuleTemporal {
272
295
  /** Stops RRULE generation once COUNT rule occurrences have been found. */
273
296
  private shouldBreakForCountLimit;
274
297
  private hasTimeOfDayBetween;
298
+ private assertNumericCandidateReachable;
299
+ private numericExhaustionCandidate;
300
+ private tryNumericNext;
301
+ private tryNumericPrevious;
302
+ private tryNumericBetween;
275
303
  /**
276
304
  * Returns all occurrences of the rule within a specified time window.
277
305
  * @param after - The start date or Temporal.ZonedDateTime object.
@@ -279,7 +307,7 @@ declare class RRuleTemporal {
279
307
  * @param inc - Optional boolean flag to include the start and end dates in the results.
280
308
  * @returns An array of Temporal.ZonedDateTime objects representing all occurrences of the rule within the specified time window.
281
309
  */
282
- between(after: DateFilter, before: DateFilter, inc?: boolean): TemporalZonedDateTime[];
310
+ between(after: DateFilter, before: DateFilter, inc?: boolean): TOutput[];
283
311
  /**
284
312
  * Compute a rule-phase-aligned DTSTART at or just before the given window
285
313
  * start, jumping forward from the original DTSTART in whole multiples of
@@ -304,7 +332,7 @@ declare class RRuleTemporal {
304
332
  * @param inc - Optional boolean flag to include occurrences on the start date.
305
333
  * @returns The next occurrence of the rule after the specified date or null if no occurrences are found.
306
334
  */
307
- next(after?: DateFilter, inc?: boolean): TemporalZonedDateTime | null;
335
+ next(after?: DateFilter, inc?: boolean): TOutput | null;
308
336
  /**
309
337
  * Build a temporary rule identical to this one but starting at the
310
338
  * phase-aligned DTSTART for the given window start. The synthetic DTSTART
@@ -317,7 +345,7 @@ declare class RRuleTemporal {
317
345
  * @param inc - Optional boolean flag to include occurrences on the end date.
318
346
  * @returns The previous occurrence of the rule before the specified date or null if no occurrences are found.
319
347
  */
320
- previous(before?: DateFilter, inc?: boolean): TemporalZonedDateTime | null;
348
+ previous(before?: DateFilter, inc?: boolean): TOutput | null;
321
349
  /** A duration of `count` steps in this rule's frequency unit. */
322
350
  private freqDuration;
323
351
  toString(): string;
@@ -374,4 +402,4 @@ declare class RRuleTemporal {
374
402
  private _allRscaleNonGregorian;
375
403
  }
376
404
  //#endregion
377
- export { DateFilter, Freq, RRuleOptions, RRuleResolvedOptions, RRuleTemporal, RRuleTemporalIterator, TemporalPlainDate, TemporalPlainDateInput, TemporalZonedDateTime, TemporalZonedDateTimeInput, Weekday, allowedFreq, allowedWeekdays, weekdayToIsoDay };
405
+ export { DateFilter, Freq, RRuleOptions, RRuleResolvedOptions, RRuleTemporal, RRuleTemporalIterator, TemporalImplementation, TemporalPlainDate, TemporalPlainDateInput, TemporalZonedDateTime, TemporalZonedDateTimeInput, Weekday, allowedFreq, allowedWeekdays, weekdayToIsoDay };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { i as weekdayToIsoDay, n as allowedFreq, r as allowedWeekdays, t as RRuleTemporal } from "./src-lJCsc0ll.js";
1
+ import { i as weekdayToIsoDay, n as allowedFreq, r as allowedWeekdays, t as RRuleTemporal } from "./src-BY_Cxfjq.js";
2
2
  export { RRuleTemporal, allowedFreq, allowedWeekdays, weekdayToIsoDay };