rrule-temporal 2.2.4 → 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 +13 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +37 -17
- package/dist/index.d.ts +37 -17
- package/dist/index.js +1 -1
- package/dist/src-5ULu8Hra.cjs +2 -0
- package/dist/src-D9fIlUxz.js +2 -0
- package/dist/totext.cjs +1 -1
- package/dist/totext.js +1 -1
- package/package.json +1 -1
- package/dist/src-B5AtsWj2.js +0 -2
- package/dist/src-DpGQ_5iS.cjs +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.
|
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-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
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
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
|
|
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
|
-
*
|
|
408
|
-
*
|
|
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.
|
|
@@ -416,6 +420,20 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
416
420
|
* @returns The previous occurrence of the rule before the specified date or null if no occurrences are found.
|
|
417
421
|
*/
|
|
418
422
|
previous(before?: DateFilter, inc?: boolean): TOutput | null;
|
|
423
|
+
/**
|
|
424
|
+
* The latest occurrence of the RRULE itself at or before the target, with explicit RDATEs
|
|
425
|
+
* held out of the scan.
|
|
426
|
+
*
|
|
427
|
+
* They have to be held out. The scan does not start from DTSTART: it starts from a
|
|
428
|
+
* phase-aligned dtstart near the target and walks forward, so the occurrences between the
|
|
429
|
+
* real DTSTART and that anchor are never generated. An RDATE is an absolute instant rather
|
|
430
|
+
* than a phase, so iterateRecurrenceSet() flushes any that predate the anchor into the same
|
|
431
|
+
* pass, and this scan keeps the last date it is handed. That leaves the last flushed RDATE
|
|
432
|
+
* standing in for a rule occurrence the aligned scan never produced -- and because the scan
|
|
433
|
+
* then has a non-null answer, the backoff loop below returns it instead of widening the
|
|
434
|
+
* window to look for the real one. previous() merges the RDATEs back in afterwards.
|
|
435
|
+
*/
|
|
436
|
+
private previousFromRule;
|
|
419
437
|
/** A duration of `count` steps in this rule's frequency unit. */
|
|
420
438
|
private freqDuration;
|
|
421
439
|
toString(): string;
|
|
@@ -454,6 +472,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
454
472
|
private pad2;
|
|
455
473
|
private monthMatchesToken;
|
|
456
474
|
private monthsOfYear;
|
|
475
|
+
private rscaleMonth;
|
|
457
476
|
private startOfYear;
|
|
458
477
|
private endOfYear;
|
|
459
478
|
private rscaleFirstWeekStart;
|
|
@@ -461,7 +480,8 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
461
480
|
private lastDayOfMonth;
|
|
462
481
|
/** Convert an ambient ZonedDateTime into polyfill space for RSCALE math. */
|
|
463
482
|
private toRscaleZdt;
|
|
464
|
-
private
|
|
483
|
+
private rscaleDate;
|
|
484
|
+
private rscaleDateAfterUntil;
|
|
465
485
|
private rscaleMatchesByYearDay;
|
|
466
486
|
private rscaleMatchesByWeekNo;
|
|
467
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
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
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
|
|
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
|
-
*
|
|
408
|
-
*
|
|
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.
|
|
@@ -416,6 +420,20 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
416
420
|
* @returns The previous occurrence of the rule before the specified date or null if no occurrences are found.
|
|
417
421
|
*/
|
|
418
422
|
previous(before?: DateFilter, inc?: boolean): TOutput | null;
|
|
423
|
+
/**
|
|
424
|
+
* The latest occurrence of the RRULE itself at or before the target, with explicit RDATEs
|
|
425
|
+
* held out of the scan.
|
|
426
|
+
*
|
|
427
|
+
* They have to be held out. The scan does not start from DTSTART: it starts from a
|
|
428
|
+
* phase-aligned dtstart near the target and walks forward, so the occurrences between the
|
|
429
|
+
* real DTSTART and that anchor are never generated. An RDATE is an absolute instant rather
|
|
430
|
+
* than a phase, so iterateRecurrenceSet() flushes any that predate the anchor into the same
|
|
431
|
+
* pass, and this scan keeps the last date it is handed. That leaves the last flushed RDATE
|
|
432
|
+
* standing in for a rule occurrence the aligned scan never produced -- and because the scan
|
|
433
|
+
* then has a non-null answer, the backoff loop below returns it instead of widening the
|
|
434
|
+
* window to look for the real one. previous() merges the RDATEs back in afterwards.
|
|
435
|
+
*/
|
|
436
|
+
private previousFromRule;
|
|
419
437
|
/** A duration of `count` steps in this rule's frequency unit. */
|
|
420
438
|
private freqDuration;
|
|
421
439
|
toString(): string;
|
|
@@ -454,6 +472,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
454
472
|
private pad2;
|
|
455
473
|
private monthMatchesToken;
|
|
456
474
|
private monthsOfYear;
|
|
475
|
+
private rscaleMonth;
|
|
457
476
|
private startOfYear;
|
|
458
477
|
private endOfYear;
|
|
459
478
|
private rscaleFirstWeekStart;
|
|
@@ -461,7 +480,8 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
|
|
|
461
480
|
private lastDayOfMonth;
|
|
462
481
|
/** Convert an ambient ZonedDateTime into polyfill space for RSCALE math. */
|
|
463
482
|
private toRscaleZdt;
|
|
464
|
-
private
|
|
483
|
+
private rscaleDate;
|
|
484
|
+
private rscaleDateAfterUntil;
|
|
465
485
|
private rscaleMatchesByYearDay;
|
|
466
486
|
private rscaleMatchesByWeekNo;
|
|
467
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-
|
|
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};
|