rrule-temporal 1.2.4 → 1.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
@@ -171,6 +171,7 @@ toText(weekly, "es");
171
171
  | he | Hebrew |
172
172
  | zh | Mandarin |
173
173
  | de | German |
174
+ | fr | French |
174
175
 
175
176
  **NOTE:** At build time you can reduce bundle size by
176
177
  defining the `TOTEXT_LANGS` environment variable (read from `process.env`),
@@ -182,12 +183,20 @@ included by default.
182
183
 
183
184
  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.
184
185
 
186
+ ### Supported Calendars
187
+
188
+ | Calendar | Description |
189
+ |--------------------|----------------------------------|
190
+ | GREGORIAN | Gregorian calendar (default) |
191
+ | CHINESE | Chinese calendar |
192
+ | HEBREW | Hebrew calendar |
193
+ | INDIAN | Saka/Indian National Calendar |
194
+
185
195
  - Spec: RFC 7529 — Non‑Gregorian Recurrence Rules in iCalendar
186
196
  https://www.rfc-editor.org/rfc/rfc7529.html
187
197
 
188
198
  What RSCALE does:
189
199
  - Extends `RRULE` with `RSCALE=<calendar>` to choose the calendar used for recurrence generation while keeping DTSTART/RECURRENCE‑ID/RDATE/EXDATE in Gregorian.
190
- - Supported calendars: `GREGORIAN`, `CHINESE`, `HEBREW`, `INDIAN` (Saka/Indian National Calendar).
191
200
  - Interprets `BY*` parts (month, day, week, etc.) in the specified calendar when expanding occurrences, then converts the generated dates back to the requested time zone.
192
201
 
193
202
  What SKIP does:
@@ -261,7 +270,7 @@ Notes
261
270
  | `next(after?, inclusive?)` | Next occurrence after a given date. |
262
271
  | `previous(before?, inclusive?)` | Previous occurrence before a date. |
263
272
  | `toString()` | Convert the rule back into `DTSTART` and `RRULE` lines. |
264
- | `toText(rule, locale?)` | Human readable description (`en`, `es`, `hi`, `yue`, `ar`, `he`, `zh`). |
273
+ | `toText(rule, locale?)` | Human readable description (`en`, `es`, `hi`, `yue`, `ar`, `he`, `zh`, `fr`). |
265
274
  | `options()` | Return the normalized options object. |
266
275
 
267
276
  ## Further examples
@@ -190,7 +190,7 @@ function parseRRuleString(input, targetTimezone, dtstart) {
190
190
  }
191
191
  var RRuleTemporal = class _RRuleTemporal {
192
192
  constructor(params) {
193
- var _a, _b, _c, _d, _e;
193
+ var _a, _b, _c, _d, _e, _f, _g;
194
194
  let manual;
195
195
  if (isIcsOpts(params)) {
196
196
  const parsed = parseRRuleString(params.rruleString, params.tzid, params.dtstart);
@@ -200,6 +200,9 @@ var RRuleTemporal = class _RRuleTemporal {
200
200
  this.tzid = (_b = (_a = parsed.tzid) != null ? _a : params.tzid) != null ? _b : "UTC";
201
201
  this.originalDtstart = parsed.dtstart;
202
202
  manual = __spreadProps(__spreadValues({}, parsed), {
203
+ // Allow explicit COUNT/UNTIL overrides when omitted from the RRULE string
204
+ count: (_c = params.count) != null ? _c : parsed.count,
205
+ until: (_d = params.until) != null ? _d : parsed.until,
203
206
  maxIterations: params.maxIterations,
204
207
  includeDtstart: params.includeDtstart,
205
208
  tzid: this.tzid
@@ -214,7 +217,7 @@ var RRuleTemporal = class _RRuleTemporal {
214
217
  this.originalDtstart = manual.dtstart;
215
218
  }
216
219
  if (!manual.freq) throw new Error("RRULE must include FREQ");
217
- manual.interval = (_c = manual.interval) != null ? _c : 1;
220
+ manual.interval = (_e = manual.interval) != null ? _e : 1;
218
221
  if (manual.interval <= 0) {
219
222
  throw new Error("Cannot create RRule: interval must be greater than 0");
220
223
  }
@@ -222,8 +225,8 @@ var RRuleTemporal = class _RRuleTemporal {
222
225
  throw new Error("Manual until must be a ZonedDateTime");
223
226
  }
224
227
  this.opts = this.sanitizeOpts(manual);
225
- this.maxIterations = (_d = manual.maxIterations) != null ? _d : 1e4;
226
- this.includeDtstart = (_e = manual.includeDtstart) != null ? _e : false;
228
+ this.maxIterations = (_f = manual.maxIterations) != null ? _f : 1e4;
229
+ this.includeDtstart = (_g = manual.includeDtstart) != null ? _g : false;
227
230
  }
228
231
  sanitizeNumericArray(arr, min, max, allowZero = false, sort = false) {
229
232
  if (!arr) return void 0;
package/dist/index.cjs CHANGED
@@ -211,7 +211,7 @@ function parseRRuleString(input, targetTimezone, dtstart) {
211
211
  }
212
212
  var RRuleTemporal = class _RRuleTemporal {
213
213
  constructor(params) {
214
- var _a, _b, _c, _d, _e;
214
+ var _a, _b, _c, _d, _e, _f, _g;
215
215
  let manual;
216
216
  if (isIcsOpts(params)) {
217
217
  const parsed = parseRRuleString(params.rruleString, params.tzid, params.dtstart);
@@ -221,6 +221,9 @@ var RRuleTemporal = class _RRuleTemporal {
221
221
  this.tzid = (_b = (_a = parsed.tzid) != null ? _a : params.tzid) != null ? _b : "UTC";
222
222
  this.originalDtstart = parsed.dtstart;
223
223
  manual = __spreadProps(__spreadValues({}, parsed), {
224
+ // Allow explicit COUNT/UNTIL overrides when omitted from the RRULE string
225
+ count: (_c = params.count) != null ? _c : parsed.count,
226
+ until: (_d = params.until) != null ? _d : parsed.until,
224
227
  maxIterations: params.maxIterations,
225
228
  includeDtstart: params.includeDtstart,
226
229
  tzid: this.tzid
@@ -235,7 +238,7 @@ var RRuleTemporal = class _RRuleTemporal {
235
238
  this.originalDtstart = manual.dtstart;
236
239
  }
237
240
  if (!manual.freq) throw new Error("RRULE must include FREQ");
238
- manual.interval = (_c = manual.interval) != null ? _c : 1;
241
+ manual.interval = (_e = manual.interval) != null ? _e : 1;
239
242
  if (manual.interval <= 0) {
240
243
  throw new Error("Cannot create RRule: interval must be greater than 0");
241
244
  }
@@ -243,8 +246,8 @@ var RRuleTemporal = class _RRuleTemporal {
243
246
  throw new Error("Manual until must be a ZonedDateTime");
244
247
  }
245
248
  this.opts = this.sanitizeOpts(manual);
246
- this.maxIterations = (_d = manual.maxIterations) != null ? _d : 1e4;
247
- this.includeDtstart = (_e = manual.includeDtstart) != null ? _e : false;
249
+ this.maxIterations = (_f = manual.maxIterations) != null ? _f : 1e4;
250
+ this.includeDtstart = (_g = manual.includeDtstart) != null ? _g : false;
248
251
  }
249
252
  sanitizeNumericArray(arr, min, max, allowZero = false, sort = false) {
250
253
  if (!arr) return void 0;
package/dist/index.d.cts CHANGED
@@ -59,6 +59,10 @@ interface ManualOpts extends BaseOpts {
59
59
  interface IcsOpts extends BaseOpts {
60
60
  rruleString: string;
61
61
  dtstart?: Temporal.ZonedDateTime;
62
+ /** COUNT: total number of occurrences, used when missing from rruleString */
63
+ count?: number;
64
+ /** UNTIL: last possible occurrence, used when missing from rruleString */
65
+ until?: Temporal.ZonedDateTime;
62
66
  }
63
67
  type RRuleOptions = ManualOpts | IcsOpts;
64
68
  type RRuleTemporalIterator = (date: Temporal.ZonedDateTime, i: number) => boolean;
package/dist/index.d.ts CHANGED
@@ -59,6 +59,10 @@ interface ManualOpts extends BaseOpts {
59
59
  interface IcsOpts extends BaseOpts {
60
60
  rruleString: string;
61
61
  dtstart?: Temporal.ZonedDateTime;
62
+ /** COUNT: total number of occurrences, used when missing from rruleString */
63
+ count?: number;
64
+ /** UNTIL: last possible occurrence, used when missing from rruleString */
65
+ until?: Temporal.ZonedDateTime;
62
66
  }
63
67
  type RRuleOptions = ManualOpts | IcsOpts;
64
68
  type RRuleTemporalIterator = (date: Temporal.ZonedDateTime, i: number) => boolean;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  RRuleTemporal
3
- } from "./chunk-GBEJLGKA.js";
3
+ } from "./chunk-UCJETDYT.js";
4
4
  export {
5
5
  RRuleTemporal
6
6
  };
package/dist/totext.cjs CHANGED
@@ -213,7 +213,7 @@ function parseRRuleString(input, targetTimezone, dtstart) {
213
213
  }
214
214
  var RRuleTemporal = class _RRuleTemporal {
215
215
  constructor(params) {
216
- var _a, _b, _c, _d, _e;
216
+ var _a, _b, _c, _d, _e, _f, _g;
217
217
  let manual;
218
218
  if (isIcsOpts(params)) {
219
219
  const parsed = parseRRuleString(params.rruleString, params.tzid, params.dtstart);
@@ -223,6 +223,9 @@ var RRuleTemporal = class _RRuleTemporal {
223
223
  this.tzid = (_b = (_a = parsed.tzid) != null ? _a : params.tzid) != null ? _b : "UTC";
224
224
  this.originalDtstart = parsed.dtstart;
225
225
  manual = __spreadProps(__spreadValues({}, parsed), {
226
+ // Allow explicit COUNT/UNTIL overrides when omitted from the RRULE string
227
+ count: (_c = params.count) != null ? _c : parsed.count,
228
+ until: (_d = params.until) != null ? _d : parsed.until,
226
229
  maxIterations: params.maxIterations,
227
230
  includeDtstart: params.includeDtstart,
228
231
  tzid: this.tzid
@@ -237,7 +240,7 @@ var RRuleTemporal = class _RRuleTemporal {
237
240
  this.originalDtstart = manual.dtstart;
238
241
  }
239
242
  if (!manual.freq) throw new Error("RRULE must include FREQ");
240
- manual.interval = (_c = manual.interval) != null ? _c : 1;
243
+ manual.interval = (_e = manual.interval) != null ? _e : 1;
241
244
  if (manual.interval <= 0) {
242
245
  throw new Error("Cannot create RRule: interval must be greater than 0");
243
246
  }
@@ -245,8 +248,8 @@ var RRuleTemporal = class _RRuleTemporal {
245
248
  throw new Error("Manual until must be a ZonedDateTime");
246
249
  }
247
250
  this.opts = this.sanitizeOpts(manual);
248
- this.maxIterations = (_d = manual.maxIterations) != null ? _d : 1e4;
249
- this.includeDtstart = (_e = manual.includeDtstart) != null ? _e : false;
251
+ this.maxIterations = (_f = manual.maxIterations) != null ? _f : 1e4;
252
+ this.includeDtstart = (_g = manual.includeDtstart) != null ? _g : false;
250
253
  }
251
254
  sanitizeNumericArray(arr, min, max, allowZero = false, sort = false) {
252
255
  if (!arr) return void 0;
@@ -2718,7 +2721,66 @@ var zh = {
2718
2721
  },
2719
2722
  ordinal: (n) => n < 0 ? "\u6700\u540E" : `\u7B2C${Math.abs(n)}`
2720
2723
  };
2721
- var ALL_LOCALES = { en, de, es, hi, yue, ar, he, zh };
2724
+ var fr = {
2725
+ weekdayNames: ["Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche"],
2726
+ monthNames: [
2727
+ "Janvier",
2728
+ "F\xE9vrier",
2729
+ "Mars",
2730
+ "Avril",
2731
+ "Mai",
2732
+ "Juin",
2733
+ "Juillet",
2734
+ "Ao\xFBt",
2735
+ "Septembre",
2736
+ "Octobre",
2737
+ "Novembre",
2738
+ "D\xE9cembre"
2739
+ ],
2740
+ units: {
2741
+ year: { singular: "ann\xE9e", plural: "ans" },
2742
+ month: { singular: "mois", plural: "mois" },
2743
+ week: { singular: "semaine", plural: "semaines" },
2744
+ day: { singular: "jour", plural: "jours" },
2745
+ hour: { singular: "heure", plural: "heures" },
2746
+ minute: { singular: "minute", plural: "minutes" },
2747
+ second: { singular: "seconde", plural: "secondes" }
2748
+ },
2749
+ words: {
2750
+ every: "chaque",
2751
+ weekday: "jour de semaine",
2752
+ on: "le",
2753
+ in: "dans",
2754
+ on_the: "le",
2755
+ day_of_month: "jour du mois",
2756
+ day_of_year: "jour de l'ann\xE9e",
2757
+ in_week: "dans la semaine",
2758
+ at: "\xE0",
2759
+ at_minute: "\xE0 la minute",
2760
+ at_second: "\xE0 la seconde",
2761
+ until: "jusqu'\xE0",
2762
+ for: "pendant",
2763
+ time: "fois",
2764
+ times: "fois",
2765
+ instance: "occurrence",
2766
+ week_starts_on: "la semaine commence le",
2767
+ with: "avec",
2768
+ additional_date: "date suppl\xE9mentaire",
2769
+ additional_dates: "dates suppl\xE9mentaires",
2770
+ excluding: "en excluant",
2771
+ date: "date",
2772
+ dates: "dates",
2773
+ and: "et",
2774
+ last: "dernier"
2775
+ },
2776
+ ordinal: (n) => {
2777
+ const abs = Math.abs(n);
2778
+ if (n < 0) return "dernier";
2779
+ if (abs === 1) return "1er";
2780
+ return `${abs}e`;
2781
+ }
2782
+ };
2783
+ var ALL_LOCALES = { en, de, es, hi, yue, ar, he, zh, fr };
2722
2784
  var env = typeof process !== "undefined" && process.env ? process.env.TOTEXT_LANGS : void 0;
2723
2785
  var active = env ? env.split(",").map((s) => s.trim()).filter(Boolean) : Object.keys(ALL_LOCALES);
2724
2786
  var LOCALES = {};
package/dist/totext.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  RRuleTemporal
3
- } from "./chunk-GBEJLGKA.js";
3
+ } from "./chunk-UCJETDYT.js";
4
4
 
5
5
  // src/totext.ts
6
6
  var en = {
@@ -454,7 +454,66 @@ var zh = {
454
454
  },
455
455
  ordinal: (n) => n < 0 ? "\u6700\u540E" : `\u7B2C${Math.abs(n)}`
456
456
  };
457
- var ALL_LOCALES = { en, de, es, hi, yue, ar, he, zh };
457
+ var fr = {
458
+ weekdayNames: ["Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche"],
459
+ monthNames: [
460
+ "Janvier",
461
+ "F\xE9vrier",
462
+ "Mars",
463
+ "Avril",
464
+ "Mai",
465
+ "Juin",
466
+ "Juillet",
467
+ "Ao\xFBt",
468
+ "Septembre",
469
+ "Octobre",
470
+ "Novembre",
471
+ "D\xE9cembre"
472
+ ],
473
+ units: {
474
+ year: { singular: "ann\xE9e", plural: "ans" },
475
+ month: { singular: "mois", plural: "mois" },
476
+ week: { singular: "semaine", plural: "semaines" },
477
+ day: { singular: "jour", plural: "jours" },
478
+ hour: { singular: "heure", plural: "heures" },
479
+ minute: { singular: "minute", plural: "minutes" },
480
+ second: { singular: "seconde", plural: "secondes" }
481
+ },
482
+ words: {
483
+ every: "chaque",
484
+ weekday: "jour de semaine",
485
+ on: "le",
486
+ in: "dans",
487
+ on_the: "le",
488
+ day_of_month: "jour du mois",
489
+ day_of_year: "jour de l'ann\xE9e",
490
+ in_week: "dans la semaine",
491
+ at: "\xE0",
492
+ at_minute: "\xE0 la minute",
493
+ at_second: "\xE0 la seconde",
494
+ until: "jusqu'\xE0",
495
+ for: "pendant",
496
+ time: "fois",
497
+ times: "fois",
498
+ instance: "occurrence",
499
+ week_starts_on: "la semaine commence le",
500
+ with: "avec",
501
+ additional_date: "date suppl\xE9mentaire",
502
+ additional_dates: "dates suppl\xE9mentaires",
503
+ excluding: "en excluant",
504
+ date: "date",
505
+ dates: "dates",
506
+ and: "et",
507
+ last: "dernier"
508
+ },
509
+ ordinal: (n) => {
510
+ const abs = Math.abs(n);
511
+ if (n < 0) return "dernier";
512
+ if (abs === 1) return "1er";
513
+ return `${abs}e`;
514
+ }
515
+ };
516
+ var ALL_LOCALES = { en, de, es, hi, yue, ar, he, zh, fr };
458
517
  var env = typeof process !== "undefined" && process.env ? process.env.TOTEXT_LANGS : void 0;
459
518
  var active = env ? env.split(",").map((s) => s.trim()).filter(Boolean) : Object.keys(ALL_LOCALES);
460
519
  var LOCALES = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rrule-temporal",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "Recurrence rule (rrule) processing using Temporal PlainDate/PlainDateTime, with cross-timezone and cross-calendar rrule support",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",