rrule-temporal 2.2.9 → 2.3.1

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
@@ -116,6 +116,7 @@ below. These correspond to the recurrence rule parts defined in RFC 5545:
116
116
  | `maxIterations` | Safety cap for advancing outer recurrence periods (defaults to 10,000). |
117
117
  | `maxCandidateEvaluations` | Safety cap for candidate datetimes evaluated within recurrence periods (defaults to 1,000,000). A query that passes it throws; raise it for a window of more dates. |
118
118
  | `includeDtstart` | Include `DTSTART` even if it does not match the pattern. |
119
+ | `allDay` | The rule has DATE values, as an all-day event does: `toString()` writes `DTSTART`, `RDATE` and `EXDATE` with `VALUE=DATE` and `UNTIL` as a date. Set for a rule read from a `VALUE=DATE` `DTSTART`. Takes effect when `dtstart` is the start of its day in the rule's time zone; the occurrences are the same either way. An `RDATE` or `EXDATE` with a time of day, or one that was read as a date-time, keeps its time. |
119
120
  | `strict` | Enforce RFC 5545 constraints strictly (defaults to false). |
120
121
  | `temporal` | Optional Temporal namespace used for public output values and their inferred types. |
121
122
  | `dtstart` | First occurrence as `Temporal.ZonedDateTime`. |
@@ -314,7 +315,7 @@ Notes
314
315
  | `occursOn(date)` | Convenience helper: true if any occurrence falls on the given `Temporal.PlainDate` in the rule's time zone (date-only, ignores time). |
315
316
  | `next(after?, inclusive?)` | Next occurrence after a given date. |
316
317
  | `previous(before?, inclusive?)` | Previous occurrence before a date. |
317
- | `toString()` | Convert the rule back into `DTSTART` and `RRULE` lines. |
318
+ | `toString()` | Convert the rule back into `DTSTART` and `RRULE` lines. An `allDay` rule, such as one read from a `VALUE=DATE` `DTSTART`, keeps `DTSTART`, `UNTIL`, `RDATE` and `EXDATE` as DATE values. |
318
319
  | `toText(rule, locale?, options?)` | Human readable description (`en`, `es`, `hi`, `yue`, `ar`, `he`, `zh`, `fr`). Options: `{ includeDtstart?: boolean, excludeTzAbbreviation?: boolean }`. |
319
320
  | `options()` | Return the normalized options object. |
320
321
 
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./src-Bca2eRPm.cjs`);exports.RRuleTemporal=e.t,exports.allowedFreq=e.n,exports.allowedWeekdays=e.r,exports.weekdayToIsoDay=e.i;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./src-CrsmuVPW.cjs`);exports.RRuleTemporal=e.t,exports.allowedFreq=e.n,exports.allowedWeekdays=e.r,exports.weekdayToIsoDay=e.i;
package/dist/index.d.cts CHANGED
@@ -28,6 +28,13 @@ interface BaseOpts<TOutput extends TemporalZonedDateTimeInput = TemporalZonedDat
28
28
  skip?: 'OMIT' | 'BACKWARD' | 'FORWARD';
29
29
  /** Memoize the full occurrence list computed by all() (defaults to true). */
30
30
  cache?: boolean;
31
+ /**
32
+ * The rule has DATE values, as an all-day event does: toString() writes DTSTART, RDATE and
33
+ * EXDATE with VALUE=DATE and UNTIL as a date. Set for a rule read from a DTSTART with
34
+ * VALUE=DATE, and returned by options(). It takes effect when dtstart is the start of its
35
+ * day in the rule's time zone, and does not change which occurrences the rule has.
36
+ */
37
+ allDay?: boolean;
31
38
  }
32
39
  type TemporalZonedDateTime = Temporal.ZonedDateTime;
33
40
  type TemporalPlainDate = Temporal.PlainDate;
@@ -112,6 +119,13 @@ type RRuleResolvedOptions<TOutput extends TemporalZonedDateTimeInput = TemporalZ
112
119
  declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = TemporalZonedDateTime> {
113
120
  private readonly tzid;
114
121
  private readonly originalDtstart;
122
+ /** An omitted calendar selects ISO in the Temporal.ZonedDateTime constructor. */
123
+ private readonly epochCalendarId?;
124
+ /**
125
+ * The instants of RDATE and EXDATE values that an all-day rule read as date-times. toString()
126
+ * keeps them so, also when they are the start of a day.
127
+ */
128
+ private readDateTimes?;
115
129
  private originalPlainDtstart?;
116
130
  private readonly opts;
117
131
  private readonly outputTemporal?;
@@ -123,11 +137,11 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
123
137
  private readonly allByDayIsoDays?;
124
138
  private readonly hasOrdinalByDay;
125
139
  private readonly canUseEpochMillisecondsPrecisionFlag;
126
- private readonly timeSlotOffsetsMs?;
127
- private readonly hasUniqueTimeSlotOffsets;
140
+ private timeSlotsCache?;
141
+ private gregorianMonthDayPatterns?;
128
142
  private readonly numericByMonths?;
129
143
  private exDateEpochNs?;
130
- private numericRDatesCache?;
144
+ private sortedRDatesCache?;
131
145
  private allResultCache?;
132
146
  private publicAllResultCache?;
133
147
  private outputConstructorFastPathAvailable?;
@@ -278,7 +292,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
278
292
  private utcZdtFromEpochMilliseconds;
279
293
  private canUseUtcCalendarFastPaths;
280
294
  private canUseUtcEpochMillisecondsPrecision;
281
- private buildTimeSlotOffsetsMs;
295
+ private get timeSlots();
282
296
  private createNumericQueryPlan;
283
297
  private buildFixedStepNumericQueryPlan;
284
298
  private resolveNumericWallMilliseconds;
@@ -298,7 +312,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
298
312
  /**
299
313
  * Index of the first of a first period's ascending candidates at or after
300
314
  * DTSTART, or null when one does not resolve or the kept ones are not a
301
- * suffix. Every candidate is resolved, as when they were materialized.
315
+ * suffix. A constant offset makes the wall and instant order identical.
302
316
  */
303
317
  private numericFirstPeriodSkip;
304
318
  /**
@@ -343,6 +357,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
343
357
  private gregorianIsoDayOfWeek;
344
358
  private monthIndexToYearMonth;
345
359
  private generateMonthlyOccurrenceDaysUtc;
360
+ private expandedMonthDays;
346
361
  private generateMonthlyOccurrenceEpochsUtc;
347
362
  private _allUtcMonthlyByDayOrMonthDay;
348
363
  private getZoneResolver;
@@ -410,12 +425,8 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
410
425
  */
411
426
  all(iterator?: RRuleTemporalIterator<TOutput>): TOutput[];
412
427
  private allInternal;
413
- /**
414
- * Converts rDate entries to ZonedDateTime and merges with existing dates.
415
- * @param dates - Array of dates to merge with
416
- * @returns Merged and deduplicated array of dates
417
- */
418
- private mergeAndDeduplicateRDates;
428
+ /** Merge chronological streams and subtract EXDATE. The generated occurrence wins ties. */
429
+ private mergeRecurrenceDates;
419
430
  /**
420
431
  * Checks if a date is in the exDate list.
421
432
  * @param date - Date to check
@@ -424,7 +435,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
424
435
  private isExcluded;
425
436
  private isExcludedEpoch;
426
437
  /** Sorted, de-duplicated, and EXDATE-filtered explicit recurrence dates. */
427
- private getNumericRDates;
438
+ private getSortedRDates;
428
439
  private numericRDateLowerBound;
429
440
  /**
430
441
  * Excludes exDate entries from the given array of dates.
@@ -547,6 +558,18 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
547
558
  /** A duration of `count` steps in this rule's frequency unit. */
548
559
  private freqDuration;
549
560
  toString(): string;
561
+ /**
562
+ * RDATE or EXDATE lines. With DATE values, a date at the start of its day is
563
+ * written as a DATE. One with a time of day, or one that was read as a
564
+ * date-time, keeps its time on a line of its own.
565
+ */
566
+ private formatDateLines;
567
+ /** An all-day rule has DATE values when its DTSTART is one: the start of its day, with no time of day. */
568
+ private hasDateValues;
569
+ /** Whether a date is the start of its day in the rule's zone, which is how a DATE value is read. */
570
+ private isStartOfDay;
571
+ /** The day of a date in the rule's zone, as a DATE value. */
572
+ private formatIcsDate;
550
573
  private formatIcsDateTime;
551
574
  private joinDates;
552
575
  /**
package/dist/index.d.ts CHANGED
@@ -28,6 +28,13 @@ interface BaseOpts<TOutput extends TemporalZonedDateTimeInput = TemporalZonedDat
28
28
  skip?: 'OMIT' | 'BACKWARD' | 'FORWARD';
29
29
  /** Memoize the full occurrence list computed by all() (defaults to true). */
30
30
  cache?: boolean;
31
+ /**
32
+ * The rule has DATE values, as an all-day event does: toString() writes DTSTART, RDATE and
33
+ * EXDATE with VALUE=DATE and UNTIL as a date. Set for a rule read from a DTSTART with
34
+ * VALUE=DATE, and returned by options(). It takes effect when dtstart is the start of its
35
+ * day in the rule's time zone, and does not change which occurrences the rule has.
36
+ */
37
+ allDay?: boolean;
31
38
  }
32
39
  type TemporalZonedDateTime = Temporal.ZonedDateTime;
33
40
  type TemporalPlainDate = Temporal.PlainDate;
@@ -112,6 +119,13 @@ type RRuleResolvedOptions<TOutput extends TemporalZonedDateTimeInput = TemporalZ
112
119
  declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = TemporalZonedDateTime> {
113
120
  private readonly tzid;
114
121
  private readonly originalDtstart;
122
+ /** An omitted calendar selects ISO in the Temporal.ZonedDateTime constructor. */
123
+ private readonly epochCalendarId?;
124
+ /**
125
+ * The instants of RDATE and EXDATE values that an all-day rule read as date-times. toString()
126
+ * keeps them so, also when they are the start of a day.
127
+ */
128
+ private readDateTimes?;
115
129
  private originalPlainDtstart?;
116
130
  private readonly opts;
117
131
  private readonly outputTemporal?;
@@ -123,11 +137,11 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
123
137
  private readonly allByDayIsoDays?;
124
138
  private readonly hasOrdinalByDay;
125
139
  private readonly canUseEpochMillisecondsPrecisionFlag;
126
- private readonly timeSlotOffsetsMs?;
127
- private readonly hasUniqueTimeSlotOffsets;
140
+ private timeSlotsCache?;
141
+ private gregorianMonthDayPatterns?;
128
142
  private readonly numericByMonths?;
129
143
  private exDateEpochNs?;
130
- private numericRDatesCache?;
144
+ private sortedRDatesCache?;
131
145
  private allResultCache?;
132
146
  private publicAllResultCache?;
133
147
  private outputConstructorFastPathAvailable?;
@@ -278,7 +292,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
278
292
  private utcZdtFromEpochMilliseconds;
279
293
  private canUseUtcCalendarFastPaths;
280
294
  private canUseUtcEpochMillisecondsPrecision;
281
- private buildTimeSlotOffsetsMs;
295
+ private get timeSlots();
282
296
  private createNumericQueryPlan;
283
297
  private buildFixedStepNumericQueryPlan;
284
298
  private resolveNumericWallMilliseconds;
@@ -298,7 +312,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
298
312
  /**
299
313
  * Index of the first of a first period's ascending candidates at or after
300
314
  * DTSTART, or null when one does not resolve or the kept ones are not a
301
- * suffix. Every candidate is resolved, as when they were materialized.
315
+ * suffix. A constant offset makes the wall and instant order identical.
302
316
  */
303
317
  private numericFirstPeriodSkip;
304
318
  /**
@@ -343,6 +357,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
343
357
  private gregorianIsoDayOfWeek;
344
358
  private monthIndexToYearMonth;
345
359
  private generateMonthlyOccurrenceDaysUtc;
360
+ private expandedMonthDays;
346
361
  private generateMonthlyOccurrenceEpochsUtc;
347
362
  private _allUtcMonthlyByDayOrMonthDay;
348
363
  private getZoneResolver;
@@ -410,12 +425,8 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
410
425
  */
411
426
  all(iterator?: RRuleTemporalIterator<TOutput>): TOutput[];
412
427
  private allInternal;
413
- /**
414
- * Converts rDate entries to ZonedDateTime and merges with existing dates.
415
- * @param dates - Array of dates to merge with
416
- * @returns Merged and deduplicated array of dates
417
- */
418
- private mergeAndDeduplicateRDates;
428
+ /** Merge chronological streams and subtract EXDATE. The generated occurrence wins ties. */
429
+ private mergeRecurrenceDates;
419
430
  /**
420
431
  * Checks if a date is in the exDate list.
421
432
  * @param date - Date to check
@@ -424,7 +435,7 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
424
435
  private isExcluded;
425
436
  private isExcludedEpoch;
426
437
  /** Sorted, de-duplicated, and EXDATE-filtered explicit recurrence dates. */
427
- private getNumericRDates;
438
+ private getSortedRDates;
428
439
  private numericRDateLowerBound;
429
440
  /**
430
441
  * Excludes exDate entries from the given array of dates.
@@ -547,6 +558,18 @@ declare class RRuleTemporal<TOutput extends TemporalZonedDateTimeInput = Tempora
547
558
  /** A duration of `count` steps in this rule's frequency unit. */
548
559
  private freqDuration;
549
560
  toString(): string;
561
+ /**
562
+ * RDATE or EXDATE lines. With DATE values, a date at the start of its day is
563
+ * written as a DATE. One with a time of day, or one that was read as a
564
+ * date-time, keeps its time on a line of its own.
565
+ */
566
+ private formatDateLines;
567
+ /** An all-day rule has DATE values when its DTSTART is one: the start of its day, with no time of day. */
568
+ private hasDateValues;
569
+ /** Whether a date is the start of its day in the rule's zone, which is how a DATE value is read. */
570
+ private isStartOfDay;
571
+ /** The day of a date in the rule's zone, as a DATE value. */
572
+ private formatIcsDate;
550
573
  private formatIcsDateTime;
551
574
  private joinDates;
552
575
  /**
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{i as e,n as t,r as n,t as r}from"./src-DOMrjyRf.js";export{r as RRuleTemporal,t as allowedFreq,n as allowedWeekdays,e as weekdayToIsoDay};
1
+ import{i as e,n as t,r as n,t as r}from"./src-DgLa5sNy.js";export{r as RRuleTemporal,t as allowedFreq,n as allowedWeekdays,e as weekdayToIsoDay};