rrule-temporal 1.2.6 → 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.
@@ -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
- if (this.opts.count !== void 0) {
1302
- let finalCount = 0;
1303
- const finalDates = [];
1304
- for (const d of excluded) {
1305
- if (finalCount >= this.opts.count) break;
1306
- if (iterator && !iterator(d, finalCount)) break;
1307
- finalDates.push(d);
1308
- finalCount++;
1309
- }
1310
- return finalDates;
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 excluded;
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 = occ;
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
- if (this.opts.count !== void 0) {
1323
- let finalCount = 0;
1324
- const finalDates = [];
1325
- for (const d of excluded) {
1326
- if (finalCount >= this.opts.count) break;
1327
- if (iterator && !iterator(d, finalCount)) break;
1328
- finalDates.push(d);
1329
- finalCount++;
1330
- }
1331
- return finalDates;
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 excluded;
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 = occ;
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
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  RRuleTemporal
3
- } from "./chunk-UCJETDYT.js";
3
+ } from "./chunk-SWKVAJTZ.js";
4
4
  export {
5
5
  RRuleTemporal
6
6
  };
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
- if (this.opts.count !== void 0) {
1325
- let finalCount = 0;
1326
- const finalDates = [];
1327
- for (const d of excluded) {
1328
- if (finalCount >= this.opts.count) break;
1329
- if (iterator && !iterator(d, finalCount)) break;
1330
- finalDates.push(d);
1331
- finalCount++;
1332
- }
1333
- return finalDates;
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 excluded;
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 = occ;
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;
package/dist/totext.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  RRuleTemporal
3
- } from "./chunk-UCJETDYT.js";
3
+ } from "./chunk-SWKVAJTZ.js";
4
4
 
5
5
  // src/totext.ts
6
6
  var en = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rrule-temporal",
3
- "version": "1.2.6",
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",