rrule-temporal 2.2.5 → 2.2.6

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
@@ -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.
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./src-CDWzulSL.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-5ULu8Hra.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;
@@ -156,13 +157,18 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
156
157
  private expandByTime;
157
158
  private localDateKey;
158
159
  private sortedUniqueDateCandidates;
160
+ /** Resolve generated wall time only after date expansion. RFC 5545 omits
161
+ * nonexistent local times; compatible disambiguation is still used for
162
+ * explicit DTSTART/RDATE inputs and the first occurrence of a repeated time.
163
+ */
164
+ private resolveGeneratedTime;
165
+ private get generationTimeZone();
159
166
  private timeOfDayNanoseconds;
160
167
  private timeSlotNanoseconds;
161
168
  /**
162
- * `ZonedDateTime.with()` can reorder or alias wall-clock slots on a day with
163
- * an offset transition (notably when a spring-forward gap is resolved). On
164
- * those uncommon dates we retain the legacy sort semantics with a bounded
165
- * one-day fallback instead of ever materializing a whole recurrence period.
169
+ * On transition dates an explicit DTSTART may refer to the later fold while
170
+ * other generated slots select the earlier fold. Resolve and sort at most
171
+ * one day of slots so iteration and BYSETPOS follow actual instant order.
166
172
  */
167
173
  private needsSortedTimeFallback;
168
174
  private createCandidateWorkBudget;
@@ -237,6 +243,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
237
243
  private canUseUtcMonthlyFastPath;
238
244
  private utcZdtFromEpochNanoseconds;
239
245
  private utcZdtFromEpochMilliseconds;
246
+ private canUseUtcCalendarFastPaths;
240
247
  private canUseUtcEpochMillisecondsPrecision;
241
248
  private buildTimeSlotOffsetsMs;
242
249
  private createNumericQueryPlan;
@@ -283,7 +290,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
283
290
  /**
284
291
  * True if the rule's nominal time of day can be skipped by a DST gap
285
292
  * anywhere in the (estimated) iteration range. Conservatively keep these
286
- * rules on the general engine for Temporal's compatible gap resolution.
293
+ * rules on the general engine, which omits invalid slots before BYSETPOS and COUNT.
287
294
  */
288
295
  private tzFastPathGapHazard;
289
296
  private allTzEpochFastPath;
@@ -303,14 +310,17 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
303
310
  */
304
311
  private _allMonthlyByDayOrMonthDay;
305
312
  private _allWeekly;
306
- private _allMonthlyByMonth;
307
- private _allYearlyByMonth;
308
313
  private _allYearlyComplex;
309
314
  private _allMinutelySecondlyComplex;
310
315
  private _allMonthlyByWeekNo;
311
316
  private _allMonthlyByYearDay;
312
317
  private _allDailyMinutelyHourlyWithBySetPos;
313
318
  private _allFallback;
319
+ /** Calendar periods advance independently of the dates and times they emit.
320
+ * Invalid inherited dates and nonexistent wall times do not consume COUNT
321
+ * or change DTSTART's fields for the following period (RFC 5545 3.3.10).
322
+ */
323
+ private _allCalendarPeriods;
314
324
  /**
315
325
  * Returns all occurrences of the rule.
316
326
  * @param iterator - An optional callback iterator function that can be used to filter or modify the occurrences.
@@ -318,12 +328,6 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
318
328
  */
319
329
  all(iterator?: RRuleTemporalIterator<TOutput>): TOutput[];
320
330
  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
331
  /**
328
332
  * Converts rDate entries to ZonedDateTime and merges with existing dates.
329
333
  * @param dates - Array of dates to merge with
@@ -404,10 +408,10 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
404
408
  */
405
409
  next(after?: DateFilter, inc?: boolean): TOutput | null;
406
410
  /**
407
- * Build a temporary rule identical to this one but starting at the
408
- * phase-aligned DTSTART for the given window start. The synthetic DTSTART
409
- * only keeps includeDtstart semantics when it coincides with the original.
411
+ * Share traversal-anchor semantics across all query methods. Only the real
412
+ * DTSTART can be forced into the occurrence set by includeDtstart.
410
413
  */
414
+ private alignedQueryStart;
411
415
  private ruleFromAlignedDtstart;
412
416
  /**
413
417
  * Returns the previous occurrence of the rule before a specified date.
@@ -468,6 +472,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
468
472
  private pad2;
469
473
  private monthMatchesToken;
470
474
  private monthsOfYear;
475
+ private rscaleMonth;
471
476
  private startOfYear;
472
477
  private endOfYear;
473
478
  private rscaleFirstWeekStart;
@@ -475,7 +480,8 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
475
480
  private lastDayOfMonth;
476
481
  /** Convert an ambient ZonedDateTime into polyfill space for RSCALE math. */
477
482
  private toRscaleZdt;
478
- private buildZdtFromPlainDate;
483
+ private rscaleDate;
484
+ private rscaleDateAfterUntil;
479
485
  private rscaleMatchesByYearDay;
480
486
  private rscaleMatchesByWeekNo;
481
487
  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;
@@ -156,13 +157,18 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
156
157
  private expandByTime;
157
158
  private localDateKey;
158
159
  private sortedUniqueDateCandidates;
160
+ /** Resolve generated wall time only after date expansion. RFC 5545 omits
161
+ * nonexistent local times; compatible disambiguation is still used for
162
+ * explicit DTSTART/RDATE inputs and the first occurrence of a repeated time.
163
+ */
164
+ private resolveGeneratedTime;
165
+ private get generationTimeZone();
159
166
  private timeOfDayNanoseconds;
160
167
  private timeSlotNanoseconds;
161
168
  /**
162
- * `ZonedDateTime.with()` can reorder or alias wall-clock slots on a day with
163
- * an offset transition (notably when a spring-forward gap is resolved). On
164
- * those uncommon dates we retain the legacy sort semantics with a bounded
165
- * one-day fallback instead of ever materializing a whole recurrence period.
169
+ * On transition dates an explicit DTSTART may refer to the later fold while
170
+ * other generated slots select the earlier fold. Resolve and sort at most
171
+ * one day of slots so iteration and BYSETPOS follow actual instant order.
166
172
  */
167
173
  private needsSortedTimeFallback;
168
174
  private createCandidateWorkBudget;
@@ -237,6 +243,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
237
243
  private canUseUtcMonthlyFastPath;
238
244
  private utcZdtFromEpochNanoseconds;
239
245
  private utcZdtFromEpochMilliseconds;
246
+ private canUseUtcCalendarFastPaths;
240
247
  private canUseUtcEpochMillisecondsPrecision;
241
248
  private buildTimeSlotOffsetsMs;
242
249
  private createNumericQueryPlan;
@@ -283,7 +290,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
283
290
  /**
284
291
  * True if the rule's nominal time of day can be skipped by a DST gap
285
292
  * anywhere in the (estimated) iteration range. Conservatively keep these
286
- * rules on the general engine for Temporal's compatible gap resolution.
293
+ * rules on the general engine, which omits invalid slots before BYSETPOS and COUNT.
287
294
  */
288
295
  private tzFastPathGapHazard;
289
296
  private allTzEpochFastPath;
@@ -303,14 +310,17 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
303
310
  */
304
311
  private _allMonthlyByDayOrMonthDay;
305
312
  private _allWeekly;
306
- private _allMonthlyByMonth;
307
- private _allYearlyByMonth;
308
313
  private _allYearlyComplex;
309
314
  private _allMinutelySecondlyComplex;
310
315
  private _allMonthlyByWeekNo;
311
316
  private _allMonthlyByYearDay;
312
317
  private _allDailyMinutelyHourlyWithBySetPos;
313
318
  private _allFallback;
319
+ /** Calendar periods advance independently of the dates and times they emit.
320
+ * Invalid inherited dates and nonexistent wall times do not consume COUNT
321
+ * or change DTSTART's fields for the following period (RFC 5545 3.3.10).
322
+ */
323
+ private _allCalendarPeriods;
314
324
  /**
315
325
  * Returns all occurrences of the rule.
316
326
  * @param iterator - An optional callback iterator function that can be used to filter or modify the occurrences.
@@ -318,12 +328,6 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
318
328
  */
319
329
  all(iterator?: RRuleTemporalIterator<TOutput>): TOutput[];
320
330
  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
331
  /**
328
332
  * Converts rDate entries to ZonedDateTime and merges with existing dates.
329
333
  * @param dates - Array of dates to merge with
@@ -404,10 +408,10 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
404
408
  */
405
409
  next(after?: DateFilter, inc?: boolean): TOutput | null;
406
410
  /**
407
- * Build a temporary rule identical to this one but starting at the
408
- * phase-aligned DTSTART for the given window start. The synthetic DTSTART
409
- * only keeps includeDtstart semantics when it coincides with the original.
411
+ * Share traversal-anchor semantics across all query methods. Only the real
412
+ * DTSTART can be forced into the occurrence set by includeDtstart.
410
413
  */
414
+ private alignedQueryStart;
411
415
  private ruleFromAlignedDtstart;
412
416
  /**
413
417
  * Returns the previous occurrence of the rule before a specified date.
@@ -468,6 +472,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
468
472
  private pad2;
469
473
  private monthMatchesToken;
470
474
  private monthsOfYear;
475
+ private rscaleMonth;
471
476
  private startOfYear;
472
477
  private endOfYear;
473
478
  private rscaleFirstWeekStart;
@@ -475,7 +480,8 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
475
480
  private lastDayOfMonth;
476
481
  /** Convert an ambient ZonedDateTime into polyfill space for RSCALE math. */
477
482
  private toRscaleZdt;
478
- private buildZdtFromPlainDate;
483
+ private rscaleDate;
484
+ private rscaleDateAfterUntil;
479
485
  private rscaleMatchesByYearDay;
480
486
  private rscaleMatchesByWeekNo;
481
487
  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-OdJ9kyVI.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-D9fIlUxz.js";export{r as RRuleTemporal,t as allowedFreq,n as allowedWeekdays,e as weekdayToIsoDay};