rrule-temporal 2.2.5 → 2.2.7
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 +93 -46
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +84 -17
- package/dist/index.d.ts +84 -17
- package/dist/index.js +1 -1
- package/dist/src-C8UqcHkR.js +2 -0
- package/dist/src-Dm68fCwO.cjs +2 -0
- package/dist/totext.cjs +1 -1
- package/dist/totext.js +1 -1
- package/package.json +1 -1
- package/dist/src-CDWzulSL.cjs +0 -2
- package/dist/src-OdJ9kyVI.js +0 -2
package/README.md
CHANGED
|
@@ -207,6 +207,19 @@ e.g. `TOTEXT_LANGS=en,es,ar`. When this environment variable is unavailable
|
|
|
207
207
|
(such as in browser builds where `process` is undefined) all languages are
|
|
208
208
|
included by default.
|
|
209
209
|
|
|
210
|
+
### Invalid recurrence dates and times
|
|
211
|
+
|
|
212
|
+
Following RFC 5545, generated dates that do not exist are omitted and do not
|
|
213
|
+
consume `COUNT`. A monthly rule starting January 31 keeps the 31st, skipping
|
|
214
|
+
shorter months; a yearly rule starting February 29 skips non-leap years.
|
|
215
|
+
Generated local times inside a daylight-saving gap are also omitted before
|
|
216
|
+
`BYSETPOS` selects occurrences. Later periods retain the original calendar
|
|
217
|
+
fields, time, and `INTERVAL` phase.
|
|
218
|
+
|
|
219
|
+
Explicit `DTSTART` and `RDATE` values follow the separate RFC date-time
|
|
220
|
+
interpretation rules. `RSCALE` with `SKIP=BACKWARD` or `SKIP=FORWARD` can
|
|
221
|
+
explicitly adjust invalid calendar dates as described below.
|
|
222
|
+
|
|
210
223
|
### RFC 7529 (RSCALE / SKIP)
|
|
211
224
|
|
|
212
225
|
This library implements the iCalendar RSCALE and SKIP extensions described in RFC 7529 for defining recurrence rules in non‑Gregorian calendars and for controlling how invalid dates are handled.
|
|
@@ -305,6 +318,38 @@ Notes
|
|
|
305
318
|
|
|
306
319
|
## Benchmarks
|
|
307
320
|
|
|
321
|
+
### Queries without COUNT and sub-daily rules (v2.2.7)
|
|
322
|
+
|
|
323
|
+
Measured September 23, 2026 on an Apple M2 Max with Node 25.2.1 and the
|
|
324
|
+
bundled Temporal polyfill, comparing builds of `v2.2.6` and v2.2.7. Every
|
|
325
|
+
scenario returned identical results from both builds before timing. Query rows
|
|
326
|
+
are warm medians per call, generation rows are uncached `all()` calls with the
|
|
327
|
+
builds alternating each sample, and the last row is the first `all()` in a
|
|
328
|
+
fresh process (median of 15).
|
|
329
|
+
|
|
330
|
+
| Scenario | v2.2.6 | v2.2.7 | Speedup |
|
|
331
|
+
| --- | ---: | ---: | ---: |
|
|
332
|
+
| WEEKLY M/W/F `next()`, no end, UTC | 61.25 us | 0.69 us | 88.77x |
|
|
333
|
+
| WEEKLY M/W/F `next()`, 40 EXDATEs, no end, Chicago | 157.5 us | 1.33 us | 118x |
|
|
334
|
+
| WEEKLY M/W/F `between()` one month, no end, UTC | 36.22 us | 6.40 us | 5.66x |
|
|
335
|
+
| MONTHLY last Friday `next()`, no end, Chicago | 68.79 us | 1.39 us | 49.49x |
|
|
336
|
+
| YEARLY `previous()`, no end, Chicago | 79.11 us | 2.23 us | 35.48x |
|
|
337
|
+
| UTC WEEKLY M/W/F with RDATE/EXDATE, `all()`, COUNT 1,000 | 12.555 ms | 0.697 ms | 18.02x |
|
|
338
|
+
| HOURLY quarter hours, `all()`, COUNT 1,000, UTC | 3.967 ms | 1.073 ms | 3.70x |
|
|
339
|
+
| MINUTELY 9:00-16:45 quarter hours, `all()`, COUNT 1,000, Chicago | 4.516 ms | 2.034 ms | 2.22x |
|
|
340
|
+
| Chicago weekdays, first `all()` in a fresh process | 23.282 ms | 4.593 ms | 5.07x |
|
|
341
|
+
|
|
342
|
+
Queries on unbounded and UNTIL-bound rules, the usual calendar case, now visit
|
|
343
|
+
only the recurrence periods around the target instead of replaying the rule
|
|
344
|
+
through Temporal. Sub-daily rules with BYxxx parts run on a new integer engine,
|
|
345
|
+
which also fixes their INTERVAL cadence, and timezone tables are built from
|
|
346
|
+
Temporal's own transitions. In the same runs, the 13 COUNT-bound query
|
|
347
|
+
scenarios measured 0.93-2.81x and the 29 existing generation scenarios
|
|
348
|
+
0.93-1.18x; isolated re-runs of the lowest cases were within 2% of v2.2.6.
|
|
349
|
+
|
|
350
|
+
See [`benchmarks/README.md`](benchmarks/README.md) for every scenario, raw
|
|
351
|
+
measurements, and the reproduction commands.
|
|
352
|
+
|
|
308
353
|
### UTC generation improvements (v2.2.4)
|
|
309
354
|
|
|
310
355
|
Measured September 5, 2026 on an Apple M2 Max with Node 25.2.1 and the
|
|
@@ -342,68 +387,70 @@ measurements, and the reproduction command.
|
|
|
342
387
|
|
|
343
388
|
### COUNT-bound queries
|
|
344
389
|
|
|
345
|
-
Measured September
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
390
|
+
Measured September 24, 2026 on an Apple M2 Max with Node 25.2.1, comparing
|
|
391
|
+
the exact `v2.2.2` tag (`6be2251`) with v2.2.7. The table reports warmed median
|
|
392
|
+
time per call from seven 300 ms samples after a 250 ms warmup; lower is better.
|
|
393
|
+
Each build ran three times in alternating processes, and the table shows the
|
|
394
|
+
median run. Both builds returned identical results, and v2.2.7 uses the
|
|
395
|
+
production-minified bundle described below.
|
|
350
396
|
|
|
351
|
-
| Scenario | v2.2.2 | v2.2.
|
|
397
|
+
| Scenario | v2.2.2 | v2.2.7 | Speedup |
|
|
352
398
|
| --- | ---: | ---: | ---: |
|
|
353
|
-
| SECONDLY next, COUNT 128, rank 63 | 9.
|
|
354
|
-
| SECONDLY next, COUNT 250k, rank 200k | 9.
|
|
355
|
-
| DAILY next, COUNT 9k, rank 8.5k, UTC |
|
|
356
|
-
| DAILY previous, COUNT 9k, rank 8.5k, Chicago |
|
|
357
|
-
| DAILY weekdays next, COUNT 9k, distant, UTC |
|
|
358
|
-
| DAILY slots narrow between, COUNT 9k, UTC |
|
|
359
|
-
| WEEKLY M/W/F slots next, COUNT 9k, UTC | 10.58 us | 1.
|
|
360
|
-
| MONTHLY last weekday next, COUNT 9k, UTC | 31.
|
|
361
|
-
| MONTHLY last weekday next, COUNT 128, rank 63 | 21.
|
|
362
|
-
| SECONDLY `occursOn()`, COUNT 100k | 254.
|
|
363
|
-
| DAILY RDATE/EXDATE next, COUNT 9k, rank 8.5k |
|
|
364
|
-
| YEARLY BYMONTH/BYMONTHDAY next, COUNT 9k, rank 8.5k |
|
|
365
|
-
| SECONDLY `all()`, COUNT 3.6k, explicit Temporal output |
|
|
399
|
+
| SECONDLY next, COUNT 128, rank 63 | 9.44 us | 0.49 us | 19.27x |
|
|
400
|
+
| SECONDLY next, COUNT 250k, rank 200k | 9.38 us | 0.52 us | 18.04x |
|
|
401
|
+
| DAILY next, COUNT 9k, rank 8.5k, UTC | 9.80 us | 1.11 us | 8.83x |
|
|
402
|
+
| DAILY previous, COUNT 9k, rank 8.5k, Chicago | 12.64 us | 2.39 us | 5.29x |
|
|
403
|
+
| DAILY weekdays next, COUNT 9k, distant, UTC | 10.00 us | 1.22 us | 8.20x |
|
|
404
|
+
| DAILY slots narrow between, COUNT 9k, UTC | 32.88 us | 5.86 us | 5.61x |
|
|
405
|
+
| WEEKLY M/W/F slots next, COUNT 9k, UTC | 10.58 us | 1.27 us | 8.33x |
|
|
406
|
+
| MONTHLY last weekday next, COUNT 9k, UTC | 31.55 us | 21.28 us | 1.48x |
|
|
407
|
+
| MONTHLY last weekday next, COUNT 128, rank 63 | 21.99 us | 11.70 us | 1.88x |
|
|
408
|
+
| SECONDLY `occursOn()`, COUNT 100k | 254.7 ms | 9.35 us | 27,241x |
|
|
409
|
+
| DAILY RDATE/EXDATE next, COUNT 9k, rank 8.5k | 53.0 ms | 1.61 us | 32,919x |
|
|
410
|
+
| YEARLY BYMONTH/BYMONTHDAY next, COUNT 9k, rank 8.5k | 388.9 ms | 7.41 us | 52,483x |
|
|
411
|
+
| SECONDLY `all()`, COUNT 3.6k, explicit Temporal output | 42.9 ms | 18.7 ms | 2.29x |
|
|
366
412
|
|
|
367
413
|
The named-zone cold call still includes lazy transition-table construction;
|
|
368
414
|
the query harness prints cold timings and each sample's warm range.
|
|
369
415
|
|
|
370
416
|
### Full recurrence generation
|
|
371
417
|
|
|
372
|
-
Uncached median ops/s
|
|
373
|
-
the polyfill backend and `rrule` 2.8.1.
|
|
374
|
-
samples after a 200 ms warmup. The
|
|
375
|
-
disables `temporal-polyfill`'s
|
|
376
|
-
|
|
418
|
+
Uncached median ops/s for v2.2.7, measured September 23, 2026 on the same
|
|
419
|
+
Apple M2 Max with Node 25.2.1 using the polyfill backend and `rrule` 2.8.1.
|
|
420
|
+
Each result is the median of five 200 ms samples after a 200 ms warmup. The
|
|
421
|
+
production bundle is minified, which disables `temporal-polyfill`'s
|
|
422
|
+
development-only per-instance debug strings. The three-library comparison,
|
|
423
|
+
query methodology, and cached-mode summary live in
|
|
377
424
|
[`benchmarks/README.md`](benchmarks/README.md).
|
|
378
425
|
|
|
379
426
|
| Scenario | TZ | rrule-temporal median ops/s | rrule median ops/s | vs rrule |
|
|
380
427
|
| --- | --- | ---: | ---: | ---: |
|
|
381
|
-
| 30 daily occurrences | UTC |
|
|
382
|
-
| 30 daily occurrences | America/Chicago |
|
|
383
|
-
| Daily weekdays across many cycles | UTC |
|
|
384
|
-
| Daily weekdays across many cycles | America/Chicago |
|
|
385
|
-
| Daily time-slot expansion | UTC | 2,
|
|
386
|
-
| Daily time-slot expansion | America/Chicago |
|
|
387
|
-
| 720 hourly occurrences | UTC | 2,
|
|
388
|
-
| 720 hourly occurrences | America/Chicago | 1,
|
|
389
|
-
| 1,440 minutely occurrences | UTC | 1,
|
|
390
|
-
| 1,440 minutely occurrences | America/Chicago |
|
|
391
|
-
| 3,600 secondly occurrences | UTC |
|
|
392
|
-
| 3,600 secondly occurrences | America/Chicago |
|
|
393
|
-
| Weekly MO/WE/FR across many cycles | UTC | 2,
|
|
394
|
-
| Weekly MO/WE/FR across many cycles | America/Chicago |
|
|
395
|
-
| Weekly day and time-slot expansion | UTC | 1,
|
|
396
|
-
| Weekly day and time-slot expansion | America/Chicago |
|
|
397
|
-
| Monthly last weekday across 20 years | UTC | 2,
|
|
398
|
-
| Monthly last weekday across 20 years | America/Chicago | 1,
|
|
399
|
-
| Monthly first and last weekday across 20 years | UTC | 1,
|
|
400
|
-
| Monthly first and last weekday across 20 years | America/Chicago | 1,
|
|
428
|
+
| 30 daily occurrences | UTC | 80,644 | 15,625 | 5.16x |
|
|
429
|
+
| 30 daily occurrences | America/Chicago | 34,793 | 288 | 120.81x |
|
|
430
|
+
| Daily weekdays across many cycles | UTC | 4,015 | 747 | 5.37x |
|
|
431
|
+
| Daily weekdays across many cycles | America/Chicago | 2,021 | 19.4 | 104.18x |
|
|
432
|
+
| Daily time-slot expansion | UTC | 2,365 | 1,045 | 2.26x |
|
|
433
|
+
| Daily time-slot expansion | America/Chicago | 1,076 | 11.5 | 93.57x |
|
|
434
|
+
| 720 hourly occurrences | UTC | 2,744 | 705 | 3.89x |
|
|
435
|
+
| 720 hourly occurrences | America/Chicago | 1,382 | 13.4 | 103.13x |
|
|
436
|
+
| 1,440 minutely occurrences | UTC | 1,740 | 337 | 5.16x |
|
|
437
|
+
| 1,440 minutely occurrences | America/Chicago | 771 | 7.1 | 108.59x |
|
|
438
|
+
| 3,600 secondly occurrences | UTC | 532 | 129 | 4.12x |
|
|
439
|
+
| 3,600 secondly occurrences | America/Chicago | 296 | 2.9 | 102.07x |
|
|
440
|
+
| Weekly MO/WE/FR across many cycles | UTC | 2,842 | 1,116 | 2.55x |
|
|
441
|
+
| Weekly MO/WE/FR across many cycles | America/Chicago | 1,235 | 14.5 | 85.17x |
|
|
442
|
+
| Weekly day and time-slot expansion | UTC | 1,784 | 1,174 | 1.52x |
|
|
443
|
+
| Weekly day and time-slot expansion | America/Chicago | 987 | 11.2 | 88.12x |
|
|
444
|
+
| Monthly last weekday across 20 years | UTC | 2,252 | 1,027 | 2.19x |
|
|
445
|
+
| Monthly last weekday across 20 years | America/Chicago | 1,681 | 44.2 | 38.03x |
|
|
446
|
+
| Monthly first and last weekday across 20 years | UTC | 1,757 | 1,042 | 1.69x |
|
|
447
|
+
| Monthly first and last weekday across 20 years | America/Chicago | 1,068 | 23.1 | 46.23x |
|
|
401
448
|
|
|
402
449
|
Time-zone-aware rules iterate through an epoch-integer engine with a cached
|
|
403
|
-
per-zone offset table, so named-zone scenarios ran
|
|
450
|
+
per-zone offset table, so named-zone scenarios ran 38-121x faster than `rrule`
|
|
404
451
|
in this pass. Minifying the production bundle removes polyfill debug
|
|
405
452
|
instrumentation from occurrence materialization, making UTC generation
|
|
406
|
-
1.
|
|
453
|
+
1.52-5.37x faster than `rrule` across every scenario. Earlier native-Temporal
|
|
407
454
|
measurements are retained in the detailed benchmark README but were not rerun
|
|
408
455
|
in this Node 25/polyfill pass. Repeated `all()` calls on the same rule instance
|
|
409
456
|
are served from an internal cache (opt out per rule with `cache: false`).
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./src-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./src-Dm68fCwO.cjs`);exports.RRuleTemporal=e.t,exports.allowedFreq=e.n,exports.allowedWeekdays=e.r,exports.weekdayToIsoDay=e.i;
|
package/dist/index.d.cts
CHANGED
|
@@ -112,6 +112,7 @@ type RRuleResolvedOptions<TOutput extends TemporalZonedDateTimeInput = TemporalZ
|
|
|
112
112
|
declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = TemporalZonedDateTime> {
|
|
113
113
|
private readonly tzid;
|
|
114
114
|
private readonly originalDtstart;
|
|
115
|
+
private originalPlainDtstart?;
|
|
115
116
|
private readonly opts;
|
|
116
117
|
private readonly outputTemporal?;
|
|
117
118
|
private readonly maxIterations;
|
|
@@ -133,6 +134,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
133
134
|
private zoneResolver?;
|
|
134
135
|
private emitAnchorZdt?;
|
|
135
136
|
private numericQueryPlanCache;
|
|
137
|
+
private periodQueryPlanCache;
|
|
136
138
|
private static readonly rscaleCalendarSupport;
|
|
137
139
|
/**
|
|
138
140
|
* Normalize a ZonedDateTime to the polyfill implementation.
|
|
@@ -156,13 +158,18 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
156
158
|
private expandByTime;
|
|
157
159
|
private localDateKey;
|
|
158
160
|
private sortedUniqueDateCandidates;
|
|
161
|
+
/** Resolve generated wall time only after date expansion. RFC 5545 omits
|
|
162
|
+
* nonexistent local times; compatible disambiguation is still used for
|
|
163
|
+
* explicit DTSTART/RDATE inputs and the first occurrence of a repeated time.
|
|
164
|
+
*/
|
|
165
|
+
private resolveGeneratedTime;
|
|
166
|
+
private get generationTimeZone();
|
|
159
167
|
private timeOfDayNanoseconds;
|
|
160
168
|
private timeSlotNanoseconds;
|
|
161
169
|
/**
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
* one-day fallback instead of ever materializing a whole recurrence period.
|
|
170
|
+
* On transition dates an explicit DTSTART may refer to the later fold while
|
|
171
|
+
* other generated slots select the earlier fold. Resolve and sort at most
|
|
172
|
+
* one day of slots so iteration and BYSETPOS follow actual instant order.
|
|
166
173
|
*/
|
|
167
174
|
private needsSortedTimeFallback;
|
|
168
175
|
private createCandidateWorkBudget;
|
|
@@ -211,6 +218,13 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
211
218
|
private matchesBySecond;
|
|
212
219
|
private matchesAll;
|
|
213
220
|
private matchesByYearDay;
|
|
221
|
+
/**
|
|
222
|
+
* The day of the year that negative BYYEARDAY values count back from: the
|
|
223
|
+
* end of month 12. Calendars with a 13th month end later, so code that
|
|
224
|
+
* seeks year days must use this rather than daysInYear to agree with
|
|
225
|
+
* matchesByYearDay.
|
|
226
|
+
*/
|
|
227
|
+
private lastByYearDay;
|
|
214
228
|
private getIsoWeekInfo;
|
|
215
229
|
private matchesByWeekNo;
|
|
216
230
|
/**
|
|
@@ -237,6 +251,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
237
251
|
private canUseUtcMonthlyFastPath;
|
|
238
252
|
private utcZdtFromEpochNanoseconds;
|
|
239
253
|
private utcZdtFromEpochMilliseconds;
|
|
254
|
+
private canUseUtcCalendarFastPaths;
|
|
240
255
|
private canUseUtcEpochMillisecondsPrecision;
|
|
241
256
|
private buildTimeSlotOffsetsMs;
|
|
242
257
|
private createNumericQueryPlan;
|
|
@@ -257,6 +272,12 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
257
272
|
private buildYearlyNumericQueryPlan;
|
|
258
273
|
private buildNumericQueryPlan;
|
|
259
274
|
private getNumericQueryPlan;
|
|
275
|
+
/**
|
|
276
|
+
* Build the period plan for a rule without COUNT. Eligibility mirrors the
|
|
277
|
+
* COUNT plans above, and periods reuse their calendar generators.
|
|
278
|
+
*/
|
|
279
|
+
private buildPeriodQueryPlan;
|
|
280
|
+
private getPeriodQueryPlan;
|
|
260
281
|
private findFirstMatchingDailyStep;
|
|
261
282
|
private allUtcFastPath;
|
|
262
283
|
private _allUtcFixedStepSimple;
|
|
@@ -283,9 +304,15 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
283
304
|
/**
|
|
284
305
|
* True if the rule's nominal time of day can be skipped by a DST gap
|
|
285
306
|
* anywhere in the (estimated) iteration range. Conservatively keep these
|
|
286
|
-
* rules on the general engine
|
|
307
|
+
* rules on the general engine, which omits invalid slots before BYSETPOS and COUNT.
|
|
287
308
|
*/
|
|
288
309
|
private tzFastPathGapHazard;
|
|
310
|
+
/**
|
|
311
|
+
* An upper bound on the wall-clock span from DTSTART to the last of the
|
|
312
|
+
* first `count` occurrences the DAILY and WEEKLY TZ fast paths emit, or
|
|
313
|
+
* undefined when none is known. Each allows a period of candidates before DTSTART.
|
|
314
|
+
*/
|
|
315
|
+
private tzFastPathCountSpanMs;
|
|
289
316
|
private allTzEpochFastPath;
|
|
290
317
|
private _allTzDailySimple;
|
|
291
318
|
private _allTzDailyExpanded;
|
|
@@ -303,14 +330,30 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
303
330
|
*/
|
|
304
331
|
private _allMonthlyByDayOrMonthDay;
|
|
305
332
|
private _allWeekly;
|
|
306
|
-
private _allMonthlyByMonth;
|
|
307
|
-
private _allYearlyByMonth;
|
|
308
333
|
private _allYearlyComplex;
|
|
309
334
|
private _allMinutelySecondlyComplex;
|
|
310
335
|
private _allMonthlyByWeekNo;
|
|
311
336
|
private _allMonthlyByYearDay;
|
|
312
337
|
private _allDailyMinutelyHourlyWithBySetPos;
|
|
313
338
|
private _allFallback;
|
|
339
|
+
/**
|
|
340
|
+
* HOURLY, MINUTELY, and SECONDLY rules with BYxxx parts (RFC 5545 3.3.10).
|
|
341
|
+
* Periods begin at DTSTART + k * INTERVAL units in exact time, the set the
|
|
342
|
+
* rule has without BYxxx parts (HOURLY;INTERVAL=1 visits a repeated wall hour
|
|
343
|
+
* once, as rawAdvance() does). Parts at or above the frequency's own unit
|
|
344
|
+
* limit which periods occur; BYMINUTE/BYSECOND below it expand a period, and
|
|
345
|
+
* BYSETPOS selects within each period. A period outside the limits jumps to
|
|
346
|
+
* the first period of the next window that can satisfy them.
|
|
347
|
+
*/
|
|
348
|
+
private _allSubDailyPeriods;
|
|
349
|
+
private matchesSubDailyDate;
|
|
350
|
+
/** A later date that may satisfy the date-level parts; none before it can. */
|
|
351
|
+
private nextSubDailyDateCandidate;
|
|
352
|
+
/** Calendar periods advance independently of the dates and times they emit.
|
|
353
|
+
* Invalid inherited dates and nonexistent wall times do not consume COUNT
|
|
354
|
+
* or change DTSTART's fields for the following period (RFC 5545 3.3.10).
|
|
355
|
+
*/
|
|
356
|
+
private _allCalendarPeriods;
|
|
314
357
|
/**
|
|
315
358
|
* Returns all occurrences of the rule.
|
|
316
359
|
* @param iterator - An optional callback iterator function that can be used to filter or modify the occurrences.
|
|
@@ -318,12 +361,6 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
318
361
|
*/
|
|
319
362
|
all(iterator?: RRuleTemporalIterator<TOutput>): TOutput[];
|
|
320
363
|
private allInternal;
|
|
321
|
-
/**
|
|
322
|
-
* RFC 7529: RSCALE present, simple monthly iteration with SKIP behavior.
|
|
323
|
-
* Handles month-to-month stepping from DTSTART's year/month aiming for DTSTART's day-of-month.
|
|
324
|
-
* Applies SKIP=OMIT (skip invalid months), BACKWARD (clamp to last day), FORWARD (first day of next month).
|
|
325
|
-
*/
|
|
326
|
-
private _allMonthlyRscaleSimple;
|
|
327
364
|
/**
|
|
328
365
|
* Converts rDate entries to ZonedDateTime and merges with existing dates.
|
|
329
366
|
* @param dates - Array of dates to merge with
|
|
@@ -369,6 +406,34 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
369
406
|
private tryNumericNext;
|
|
370
407
|
private tryNumericPrevious;
|
|
371
408
|
private tryNumericBetween;
|
|
409
|
+
/**
|
|
410
|
+
* Periods a plan may scan while the general engine it replaces stays within
|
|
411
|
+
* maxIterations and maxCandidateEvaluations. previous() backs its search off
|
|
412
|
+
* in powers of four, so its engine can visit four times the periods scanned.
|
|
413
|
+
*/
|
|
414
|
+
private periodScanBudget;
|
|
415
|
+
/** Resolve a period's wall times, or null when any needs the general engine (e.g. a DST gap). */
|
|
416
|
+
private resolvePeriodEpochs;
|
|
417
|
+
private isExcludedEpochMilliseconds;
|
|
418
|
+
/**
|
|
419
|
+
* First RRULE instant at or after `lowerMs` that EXDATE does not remove. An
|
|
420
|
+
* instant after `stopAfterMs` is returned unchecked: a caller holding an
|
|
421
|
+
* earlier RDATE needs no later rule instant. Returns null when UNTIL ends the
|
|
422
|
+
* rule first, and undefined when the general engine must answer.
|
|
423
|
+
*/
|
|
424
|
+
private periodScanForward;
|
|
425
|
+
/**
|
|
426
|
+
* Last RRULE instant at or before `upperMs` (and UNTIL) that EXDATE does not
|
|
427
|
+
* remove. An instant before `stopBeforeMs` is returned unchecked: a caller
|
|
428
|
+
* holding a later RDATE needs no earlier rule instant. Returns null before
|
|
429
|
+
* DTSTART, and undefined when the general engine must answer.
|
|
430
|
+
*/
|
|
431
|
+
private periodScanBackward;
|
|
432
|
+
/** RRULE instants in [lowerMs, upperMs] without EXDATEs, or null when the general engine must answer. */
|
|
433
|
+
private periodEpochsBetween;
|
|
434
|
+
private tryPeriodNext;
|
|
435
|
+
private tryPeriodPrevious;
|
|
436
|
+
private tryPeriodBetween;
|
|
372
437
|
/**
|
|
373
438
|
* Returns all occurrences of the rule within a specified time window.
|
|
374
439
|
* @param after - The start date or Temporal.ZonedDateTime object.
|
|
@@ -404,10 +469,10 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
404
469
|
*/
|
|
405
470
|
next(after?: DateFilter, inc?: boolean): TOutput | null;
|
|
406
471
|
/**
|
|
407
|
-
*
|
|
408
|
-
*
|
|
409
|
-
* only keeps includeDtstart semantics when it coincides with the original.
|
|
472
|
+
* Share traversal-anchor semantics across all query methods. Only the real
|
|
473
|
+
* DTSTART can be forced into the occurrence set by includeDtstart.
|
|
410
474
|
*/
|
|
475
|
+
private alignedQueryStart;
|
|
411
476
|
private ruleFromAlignedDtstart;
|
|
412
477
|
/**
|
|
413
478
|
* Returns the previous occurrence of the rule before a specified date.
|
|
@@ -468,6 +533,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
468
533
|
private pad2;
|
|
469
534
|
private monthMatchesToken;
|
|
470
535
|
private monthsOfYear;
|
|
536
|
+
private rscaleMonth;
|
|
471
537
|
private startOfYear;
|
|
472
538
|
private endOfYear;
|
|
473
539
|
private rscaleFirstWeekStart;
|
|
@@ -475,7 +541,8 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
475
541
|
private lastDayOfMonth;
|
|
476
542
|
/** Convert an ambient ZonedDateTime into polyfill space for RSCALE math. */
|
|
477
543
|
private toRscaleZdt;
|
|
478
|
-
private
|
|
544
|
+
private rscaleDate;
|
|
545
|
+
private rscaleDateAfterUntil;
|
|
479
546
|
private rscaleMatchesByYearDay;
|
|
480
547
|
private rscaleMatchesByWeekNo;
|
|
481
548
|
private rscaleMatchesByMonth;
|
package/dist/index.d.ts
CHANGED
|
@@ -112,6 +112,7 @@ type RRuleResolvedOptions<TOutput extends TemporalZonedDateTimeInput = TemporalZ
|
|
|
112
112
|
declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = TemporalZonedDateTime> {
|
|
113
113
|
private readonly tzid;
|
|
114
114
|
private readonly originalDtstart;
|
|
115
|
+
private originalPlainDtstart?;
|
|
115
116
|
private readonly opts;
|
|
116
117
|
private readonly outputTemporal?;
|
|
117
118
|
private readonly maxIterations;
|
|
@@ -133,6 +134,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
133
134
|
private zoneResolver?;
|
|
134
135
|
private emitAnchorZdt?;
|
|
135
136
|
private numericQueryPlanCache;
|
|
137
|
+
private periodQueryPlanCache;
|
|
136
138
|
private static readonly rscaleCalendarSupport;
|
|
137
139
|
/**
|
|
138
140
|
* Normalize a ZonedDateTime to the polyfill implementation.
|
|
@@ -156,13 +158,18 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
156
158
|
private expandByTime;
|
|
157
159
|
private localDateKey;
|
|
158
160
|
private sortedUniqueDateCandidates;
|
|
161
|
+
/** Resolve generated wall time only after date expansion. RFC 5545 omits
|
|
162
|
+
* nonexistent local times; compatible disambiguation is still used for
|
|
163
|
+
* explicit DTSTART/RDATE inputs and the first occurrence of a repeated time.
|
|
164
|
+
*/
|
|
165
|
+
private resolveGeneratedTime;
|
|
166
|
+
private get generationTimeZone();
|
|
159
167
|
private timeOfDayNanoseconds;
|
|
160
168
|
private timeSlotNanoseconds;
|
|
161
169
|
/**
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
* one-day fallback instead of ever materializing a whole recurrence period.
|
|
170
|
+
* On transition dates an explicit DTSTART may refer to the later fold while
|
|
171
|
+
* other generated slots select the earlier fold. Resolve and sort at most
|
|
172
|
+
* one day of slots so iteration and BYSETPOS follow actual instant order.
|
|
166
173
|
*/
|
|
167
174
|
private needsSortedTimeFallback;
|
|
168
175
|
private createCandidateWorkBudget;
|
|
@@ -211,6 +218,13 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
211
218
|
private matchesBySecond;
|
|
212
219
|
private matchesAll;
|
|
213
220
|
private matchesByYearDay;
|
|
221
|
+
/**
|
|
222
|
+
* The day of the year that negative BYYEARDAY values count back from: the
|
|
223
|
+
* end of month 12. Calendars with a 13th month end later, so code that
|
|
224
|
+
* seeks year days must use this rather than daysInYear to agree with
|
|
225
|
+
* matchesByYearDay.
|
|
226
|
+
*/
|
|
227
|
+
private lastByYearDay;
|
|
214
228
|
private getIsoWeekInfo;
|
|
215
229
|
private matchesByWeekNo;
|
|
216
230
|
/**
|
|
@@ -237,6 +251,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
237
251
|
private canUseUtcMonthlyFastPath;
|
|
238
252
|
private utcZdtFromEpochNanoseconds;
|
|
239
253
|
private utcZdtFromEpochMilliseconds;
|
|
254
|
+
private canUseUtcCalendarFastPaths;
|
|
240
255
|
private canUseUtcEpochMillisecondsPrecision;
|
|
241
256
|
private buildTimeSlotOffsetsMs;
|
|
242
257
|
private createNumericQueryPlan;
|
|
@@ -257,6 +272,12 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
257
272
|
private buildYearlyNumericQueryPlan;
|
|
258
273
|
private buildNumericQueryPlan;
|
|
259
274
|
private getNumericQueryPlan;
|
|
275
|
+
/**
|
|
276
|
+
* Build the period plan for a rule without COUNT. Eligibility mirrors the
|
|
277
|
+
* COUNT plans above, and periods reuse their calendar generators.
|
|
278
|
+
*/
|
|
279
|
+
private buildPeriodQueryPlan;
|
|
280
|
+
private getPeriodQueryPlan;
|
|
260
281
|
private findFirstMatchingDailyStep;
|
|
261
282
|
private allUtcFastPath;
|
|
262
283
|
private _allUtcFixedStepSimple;
|
|
@@ -283,9 +304,15 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
283
304
|
/**
|
|
284
305
|
* True if the rule's nominal time of day can be skipped by a DST gap
|
|
285
306
|
* anywhere in the (estimated) iteration range. Conservatively keep these
|
|
286
|
-
* rules on the general engine
|
|
307
|
+
* rules on the general engine, which omits invalid slots before BYSETPOS and COUNT.
|
|
287
308
|
*/
|
|
288
309
|
private tzFastPathGapHazard;
|
|
310
|
+
/**
|
|
311
|
+
* An upper bound on the wall-clock span from DTSTART to the last of the
|
|
312
|
+
* first `count` occurrences the DAILY and WEEKLY TZ fast paths emit, or
|
|
313
|
+
* undefined when none is known. Each allows a period of candidates before DTSTART.
|
|
314
|
+
*/
|
|
315
|
+
private tzFastPathCountSpanMs;
|
|
289
316
|
private allTzEpochFastPath;
|
|
290
317
|
private _allTzDailySimple;
|
|
291
318
|
private _allTzDailyExpanded;
|
|
@@ -303,14 +330,30 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
303
330
|
*/
|
|
304
331
|
private _allMonthlyByDayOrMonthDay;
|
|
305
332
|
private _allWeekly;
|
|
306
|
-
private _allMonthlyByMonth;
|
|
307
|
-
private _allYearlyByMonth;
|
|
308
333
|
private _allYearlyComplex;
|
|
309
334
|
private _allMinutelySecondlyComplex;
|
|
310
335
|
private _allMonthlyByWeekNo;
|
|
311
336
|
private _allMonthlyByYearDay;
|
|
312
337
|
private _allDailyMinutelyHourlyWithBySetPos;
|
|
313
338
|
private _allFallback;
|
|
339
|
+
/**
|
|
340
|
+
* HOURLY, MINUTELY, and SECONDLY rules with BYxxx parts (RFC 5545 3.3.10).
|
|
341
|
+
* Periods begin at DTSTART + k * INTERVAL units in exact time, the set the
|
|
342
|
+
* rule has without BYxxx parts (HOURLY;INTERVAL=1 visits a repeated wall hour
|
|
343
|
+
* once, as rawAdvance() does). Parts at or above the frequency's own unit
|
|
344
|
+
* limit which periods occur; BYMINUTE/BYSECOND below it expand a period, and
|
|
345
|
+
* BYSETPOS selects within each period. A period outside the limits jumps to
|
|
346
|
+
* the first period of the next window that can satisfy them.
|
|
347
|
+
*/
|
|
348
|
+
private _allSubDailyPeriods;
|
|
349
|
+
private matchesSubDailyDate;
|
|
350
|
+
/** A later date that may satisfy the date-level parts; none before it can. */
|
|
351
|
+
private nextSubDailyDateCandidate;
|
|
352
|
+
/** Calendar periods advance independently of the dates and times they emit.
|
|
353
|
+
* Invalid inherited dates and nonexistent wall times do not consume COUNT
|
|
354
|
+
* or change DTSTART's fields for the following period (RFC 5545 3.3.10).
|
|
355
|
+
*/
|
|
356
|
+
private _allCalendarPeriods;
|
|
314
357
|
/**
|
|
315
358
|
* Returns all occurrences of the rule.
|
|
316
359
|
* @param iterator - An optional callback iterator function that can be used to filter or modify the occurrences.
|
|
@@ -318,12 +361,6 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
318
361
|
*/
|
|
319
362
|
all(iterator?: RRuleTemporalIterator<TOutput>): TOutput[];
|
|
320
363
|
private allInternal;
|
|
321
|
-
/**
|
|
322
|
-
* RFC 7529: RSCALE present, simple monthly iteration with SKIP behavior.
|
|
323
|
-
* Handles month-to-month stepping from DTSTART's year/month aiming for DTSTART's day-of-month.
|
|
324
|
-
* Applies SKIP=OMIT (skip invalid months), BACKWARD (clamp to last day), FORWARD (first day of next month).
|
|
325
|
-
*/
|
|
326
|
-
private _allMonthlyRscaleSimple;
|
|
327
364
|
/**
|
|
328
365
|
* Converts rDate entries to ZonedDateTime and merges with existing dates.
|
|
329
366
|
* @param dates - Array of dates to merge with
|
|
@@ -369,6 +406,34 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
369
406
|
private tryNumericNext;
|
|
370
407
|
private tryNumericPrevious;
|
|
371
408
|
private tryNumericBetween;
|
|
409
|
+
/**
|
|
410
|
+
* Periods a plan may scan while the general engine it replaces stays within
|
|
411
|
+
* maxIterations and maxCandidateEvaluations. previous() backs its search off
|
|
412
|
+
* in powers of four, so its engine can visit four times the periods scanned.
|
|
413
|
+
*/
|
|
414
|
+
private periodScanBudget;
|
|
415
|
+
/** Resolve a period's wall times, or null when any needs the general engine (e.g. a DST gap). */
|
|
416
|
+
private resolvePeriodEpochs;
|
|
417
|
+
private isExcludedEpochMilliseconds;
|
|
418
|
+
/**
|
|
419
|
+
* First RRULE instant at or after `lowerMs` that EXDATE does not remove. An
|
|
420
|
+
* instant after `stopAfterMs` is returned unchecked: a caller holding an
|
|
421
|
+
* earlier RDATE needs no later rule instant. Returns null when UNTIL ends the
|
|
422
|
+
* rule first, and undefined when the general engine must answer.
|
|
423
|
+
*/
|
|
424
|
+
private periodScanForward;
|
|
425
|
+
/**
|
|
426
|
+
* Last RRULE instant at or before `upperMs` (and UNTIL) that EXDATE does not
|
|
427
|
+
* remove. An instant before `stopBeforeMs` is returned unchecked: a caller
|
|
428
|
+
* holding a later RDATE needs no earlier rule instant. Returns null before
|
|
429
|
+
* DTSTART, and undefined when the general engine must answer.
|
|
430
|
+
*/
|
|
431
|
+
private periodScanBackward;
|
|
432
|
+
/** RRULE instants in [lowerMs, upperMs] without EXDATEs, or null when the general engine must answer. */
|
|
433
|
+
private periodEpochsBetween;
|
|
434
|
+
private tryPeriodNext;
|
|
435
|
+
private tryPeriodPrevious;
|
|
436
|
+
private tryPeriodBetween;
|
|
372
437
|
/**
|
|
373
438
|
* Returns all occurrences of the rule within a specified time window.
|
|
374
439
|
* @param after - The start date or Temporal.ZonedDateTime object.
|
|
@@ -404,10 +469,10 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
404
469
|
*/
|
|
405
470
|
next(after?: DateFilter, inc?: boolean): TOutput | null;
|
|
406
471
|
/**
|
|
407
|
-
*
|
|
408
|
-
*
|
|
409
|
-
* only keeps includeDtstart semantics when it coincides with the original.
|
|
472
|
+
* Share traversal-anchor semantics across all query methods. Only the real
|
|
473
|
+
* DTSTART can be forced into the occurrence set by includeDtstart.
|
|
410
474
|
*/
|
|
475
|
+
private alignedQueryStart;
|
|
411
476
|
private ruleFromAlignedDtstart;
|
|
412
477
|
/**
|
|
413
478
|
* Returns the previous occurrence of the rule before a specified date.
|
|
@@ -468,6 +533,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
468
533
|
private pad2;
|
|
469
534
|
private monthMatchesToken;
|
|
470
535
|
private monthsOfYear;
|
|
536
|
+
private rscaleMonth;
|
|
471
537
|
private startOfYear;
|
|
472
538
|
private endOfYear;
|
|
473
539
|
private rscaleFirstWeekStart;
|
|
@@ -475,7 +541,8 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
475
541
|
private lastDayOfMonth;
|
|
476
542
|
/** Convert an ambient ZonedDateTime into polyfill space for RSCALE math. */
|
|
477
543
|
private toRscaleZdt;
|
|
478
|
-
private
|
|
544
|
+
private rscaleDate;
|
|
545
|
+
private rscaleDateAfterUntil;
|
|
479
546
|
private rscaleMatchesByYearDay;
|
|
480
547
|
private rscaleMatchesByWeekNo;
|
|
481
548
|
private rscaleMatchesByMonth;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t,r as n,t as r}from"./src-
|
|
1
|
+
import{i as e,n as t,r as n,t as r}from"./src-C8UqcHkR.js";export{r as RRuleTemporal,t as allowedFreq,n as allowedWeekdays,e as weekdayToIsoDay};
|