rrule-temporal 1.2.5 → 1.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 +11 -2
- package/dist/{chunk-UCJETDYT.js → chunk-SWKVAJTZ.js} +16 -12
- package/dist/index.cjs +16 -12
- package/dist/index.js +1 -1
- package/dist/totext.cjs +76 -13
- package/dist/totext.js +61 -2
- package/package.json +1 -1
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
|
|
@@ -1298,18 +1298,20 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1298
1298
|
applyCountLimitAndMergeRDates(dates, iterator) {
|
|
1299
1299
|
const merged = this.mergeAndDeduplicateRDates(dates);
|
|
1300
1300
|
const excluded = this.excludeExDates(merged);
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1301
|
+
const hasCountLimit = this.opts.count !== void 0;
|
|
1302
|
+
if (!hasCountLimit && !iterator) {
|
|
1303
|
+
return excluded;
|
|
1304
|
+
}
|
|
1305
|
+
let emitted = 0;
|
|
1306
|
+
const max = hasCountLimit ? this.opts.count : Infinity;
|
|
1307
|
+
const finalDates = [];
|
|
1308
|
+
for (const d of excluded) {
|
|
1309
|
+
if (emitted >= max) break;
|
|
1310
|
+
if (iterator && !iterator(d, emitted)) break;
|
|
1311
|
+
finalDates.push(d);
|
|
1312
|
+
emitted++;
|
|
1311
1313
|
}
|
|
1312
|
-
return
|
|
1314
|
+
return finalDates;
|
|
1313
1315
|
}
|
|
1314
1316
|
/**
|
|
1315
1317
|
* Checks if the count limit should break the loop based on rDate presence.
|
|
@@ -1424,7 +1426,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1424
1426
|
const inst = occ.toInstant();
|
|
1425
1427
|
const ok = inc ? Temporal.Instant.compare(inst, afterInst) >= 0 : Temporal.Instant.compare(inst, afterInst) > 0;
|
|
1426
1428
|
if (ok) {
|
|
1427
|
-
result
|
|
1429
|
+
if (!result || Temporal.ZonedDateTime.compare(occ, result) < 0) {
|
|
1430
|
+
result = occ;
|
|
1431
|
+
}
|
|
1428
1432
|
return false;
|
|
1429
1433
|
}
|
|
1430
1434
|
return true;
|
package/dist/index.cjs
CHANGED
|
@@ -1319,18 +1319,20 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1319
1319
|
applyCountLimitAndMergeRDates(dates, iterator) {
|
|
1320
1320
|
const merged = this.mergeAndDeduplicateRDates(dates);
|
|
1321
1321
|
const excluded = this.excludeExDates(merged);
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1322
|
+
const hasCountLimit = this.opts.count !== void 0;
|
|
1323
|
+
if (!hasCountLimit && !iterator) {
|
|
1324
|
+
return excluded;
|
|
1325
|
+
}
|
|
1326
|
+
let emitted = 0;
|
|
1327
|
+
const max = hasCountLimit ? this.opts.count : Infinity;
|
|
1328
|
+
const finalDates = [];
|
|
1329
|
+
for (const d of excluded) {
|
|
1330
|
+
if (emitted >= max) break;
|
|
1331
|
+
if (iterator && !iterator(d, emitted)) break;
|
|
1332
|
+
finalDates.push(d);
|
|
1333
|
+
emitted++;
|
|
1332
1334
|
}
|
|
1333
|
-
return
|
|
1335
|
+
return finalDates;
|
|
1334
1336
|
}
|
|
1335
1337
|
/**
|
|
1336
1338
|
* Checks if the count limit should break the loop based on rDate presence.
|
|
@@ -1445,7 +1447,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1445
1447
|
const inst = occ.toInstant();
|
|
1446
1448
|
const ok = inc ? import_polyfill.Temporal.Instant.compare(inst, afterInst) >= 0 : import_polyfill.Temporal.Instant.compare(inst, afterInst) > 0;
|
|
1447
1449
|
if (ok) {
|
|
1448
|
-
result
|
|
1450
|
+
if (!result || import_polyfill.Temporal.ZonedDateTime.compare(occ, result) < 0) {
|
|
1451
|
+
result = occ;
|
|
1452
|
+
}
|
|
1449
1453
|
return false;
|
|
1450
1454
|
}
|
|
1451
1455
|
return true;
|
package/dist/index.js
CHANGED
package/dist/totext.cjs
CHANGED
|
@@ -1321,18 +1321,20 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1321
1321
|
applyCountLimitAndMergeRDates(dates, iterator) {
|
|
1322
1322
|
const merged = this.mergeAndDeduplicateRDates(dates);
|
|
1323
1323
|
const excluded = this.excludeExDates(merged);
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1324
|
+
const hasCountLimit = this.opts.count !== void 0;
|
|
1325
|
+
if (!hasCountLimit && !iterator) {
|
|
1326
|
+
return excluded;
|
|
1327
|
+
}
|
|
1328
|
+
let emitted = 0;
|
|
1329
|
+
const max = hasCountLimit ? this.opts.count : Infinity;
|
|
1330
|
+
const finalDates = [];
|
|
1331
|
+
for (const d of excluded) {
|
|
1332
|
+
if (emitted >= max) break;
|
|
1333
|
+
if (iterator && !iterator(d, emitted)) break;
|
|
1334
|
+
finalDates.push(d);
|
|
1335
|
+
emitted++;
|
|
1334
1336
|
}
|
|
1335
|
-
return
|
|
1337
|
+
return finalDates;
|
|
1336
1338
|
}
|
|
1337
1339
|
/**
|
|
1338
1340
|
* Checks if the count limit should break the loop based on rDate presence.
|
|
@@ -1447,7 +1449,9 @@ var RRuleTemporal = class _RRuleTemporal {
|
|
|
1447
1449
|
const inst = occ.toInstant();
|
|
1448
1450
|
const ok = inc ? import_polyfill.Temporal.Instant.compare(inst, afterInst) >= 0 : import_polyfill.Temporal.Instant.compare(inst, afterInst) > 0;
|
|
1449
1451
|
if (ok) {
|
|
1450
|
-
result
|
|
1452
|
+
if (!result || import_polyfill.Temporal.ZonedDateTime.compare(occ, result) < 0) {
|
|
1453
|
+
result = occ;
|
|
1454
|
+
}
|
|
1451
1455
|
return false;
|
|
1452
1456
|
}
|
|
1453
1457
|
return true;
|
|
@@ -2721,7 +2725,66 @@ var zh = {
|
|
|
2721
2725
|
},
|
|
2722
2726
|
ordinal: (n) => n < 0 ? "\u6700\u540E" : `\u7B2C${Math.abs(n)}`
|
|
2723
2727
|
};
|
|
2724
|
-
var
|
|
2728
|
+
var fr = {
|
|
2729
|
+
weekdayNames: ["Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche"],
|
|
2730
|
+
monthNames: [
|
|
2731
|
+
"Janvier",
|
|
2732
|
+
"F\xE9vrier",
|
|
2733
|
+
"Mars",
|
|
2734
|
+
"Avril",
|
|
2735
|
+
"Mai",
|
|
2736
|
+
"Juin",
|
|
2737
|
+
"Juillet",
|
|
2738
|
+
"Ao\xFBt",
|
|
2739
|
+
"Septembre",
|
|
2740
|
+
"Octobre",
|
|
2741
|
+
"Novembre",
|
|
2742
|
+
"D\xE9cembre"
|
|
2743
|
+
],
|
|
2744
|
+
units: {
|
|
2745
|
+
year: { singular: "ann\xE9e", plural: "ans" },
|
|
2746
|
+
month: { singular: "mois", plural: "mois" },
|
|
2747
|
+
week: { singular: "semaine", plural: "semaines" },
|
|
2748
|
+
day: { singular: "jour", plural: "jours" },
|
|
2749
|
+
hour: { singular: "heure", plural: "heures" },
|
|
2750
|
+
minute: { singular: "minute", plural: "minutes" },
|
|
2751
|
+
second: { singular: "seconde", plural: "secondes" }
|
|
2752
|
+
},
|
|
2753
|
+
words: {
|
|
2754
|
+
every: "chaque",
|
|
2755
|
+
weekday: "jour de semaine",
|
|
2756
|
+
on: "le",
|
|
2757
|
+
in: "dans",
|
|
2758
|
+
on_the: "le",
|
|
2759
|
+
day_of_month: "jour du mois",
|
|
2760
|
+
day_of_year: "jour de l'ann\xE9e",
|
|
2761
|
+
in_week: "dans la semaine",
|
|
2762
|
+
at: "\xE0",
|
|
2763
|
+
at_minute: "\xE0 la minute",
|
|
2764
|
+
at_second: "\xE0 la seconde",
|
|
2765
|
+
until: "jusqu'\xE0",
|
|
2766
|
+
for: "pendant",
|
|
2767
|
+
time: "fois",
|
|
2768
|
+
times: "fois",
|
|
2769
|
+
instance: "occurrence",
|
|
2770
|
+
week_starts_on: "la semaine commence le",
|
|
2771
|
+
with: "avec",
|
|
2772
|
+
additional_date: "date suppl\xE9mentaire",
|
|
2773
|
+
additional_dates: "dates suppl\xE9mentaires",
|
|
2774
|
+
excluding: "en excluant",
|
|
2775
|
+
date: "date",
|
|
2776
|
+
dates: "dates",
|
|
2777
|
+
and: "et",
|
|
2778
|
+
last: "dernier"
|
|
2779
|
+
},
|
|
2780
|
+
ordinal: (n) => {
|
|
2781
|
+
const abs = Math.abs(n);
|
|
2782
|
+
if (n < 0) return "dernier";
|
|
2783
|
+
if (abs === 1) return "1er";
|
|
2784
|
+
return `${abs}e`;
|
|
2785
|
+
}
|
|
2786
|
+
};
|
|
2787
|
+
var ALL_LOCALES = { en, de, es, hi, yue, ar, he, zh, fr };
|
|
2725
2788
|
var env = typeof process !== "undefined" && process.env ? process.env.TOTEXT_LANGS : void 0;
|
|
2726
2789
|
var active = env ? env.split(",").map((s) => s.trim()).filter(Boolean) : Object.keys(ALL_LOCALES);
|
|
2727
2790
|
var LOCALES = {};
|
package/dist/totext.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RRuleTemporal
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SWKVAJTZ.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
|
|
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.
|
|
3
|
+
"version": "1.2.7",
|
|
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",
|