rrule-temporal 0.2.1 → 0.2.2
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/dist/index.cjs +17 -30
- package/dist/index.js +17 -30
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -613,23 +613,17 @@ var RRuleTemporal = class {
|
|
|
613
613
|
*/
|
|
614
614
|
next(after = /* @__PURE__ */ new Date(), inc = false) {
|
|
615
615
|
const afterInst = after instanceof Date ? import_polyfill.Temporal.Instant.from(after.toISOString()) : after.toInstant();
|
|
616
|
-
let
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
const
|
|
620
|
-
if (
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
matchCount++;
|
|
624
|
-
if (this.opts.count !== void 0 && matchCount >= this.opts.count) {
|
|
625
|
-
return null;
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
if (this.opts.until && import_polyfill.Temporal.ZonedDateTime.compare(current, this.opts.until) >= 0) {
|
|
629
|
-
return null;
|
|
616
|
+
let result = null;
|
|
617
|
+
this.all((occ) => {
|
|
618
|
+
const inst = occ.toInstant();
|
|
619
|
+
const ok = inc ? import_polyfill.Temporal.Instant.compare(inst, afterInst) >= 0 : import_polyfill.Temporal.Instant.compare(inst, afterInst) > 0;
|
|
620
|
+
if (ok) {
|
|
621
|
+
result = occ;
|
|
622
|
+
return false;
|
|
630
623
|
}
|
|
631
|
-
|
|
632
|
-
}
|
|
624
|
+
return true;
|
|
625
|
+
});
|
|
626
|
+
return result;
|
|
633
627
|
}
|
|
634
628
|
/**
|
|
635
629
|
* Returns the previous occurrence of the rule before a specified date.
|
|
@@ -639,21 +633,14 @@ var RRuleTemporal = class {
|
|
|
639
633
|
*/
|
|
640
634
|
previous(before = /* @__PURE__ */ new Date(), inc = false) {
|
|
641
635
|
const beforeInst = before instanceof Date ? import_polyfill.Temporal.Instant.from(before.toISOString()) : before.toInstant();
|
|
642
|
-
let current = this.computeFirst();
|
|
643
636
|
let prev = null;
|
|
644
|
-
|
|
645
|
-
const inst =
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
}
|
|
652
|
-
if (this.opts.until && import_polyfill.Temporal.ZonedDateTime.compare(current, this.opts.until) >= 0) {
|
|
653
|
-
break;
|
|
654
|
-
}
|
|
655
|
-
current = this.nextCandidateSameDate(current);
|
|
656
|
-
}
|
|
637
|
+
this.all((occ) => {
|
|
638
|
+
const inst = occ.toInstant();
|
|
639
|
+
const beyond = inc ? import_polyfill.Temporal.Instant.compare(inst, beforeInst) > 0 : import_polyfill.Temporal.Instant.compare(inst, beforeInst) >= 0;
|
|
640
|
+
if (beyond) return false;
|
|
641
|
+
prev = occ;
|
|
642
|
+
return true;
|
|
643
|
+
});
|
|
657
644
|
return prev;
|
|
658
645
|
}
|
|
659
646
|
toString() {
|
package/dist/index.js
CHANGED
|
@@ -589,23 +589,17 @@ var RRuleTemporal = class {
|
|
|
589
589
|
*/
|
|
590
590
|
next(after = /* @__PURE__ */ new Date(), inc = false) {
|
|
591
591
|
const afterInst = after instanceof Date ? Temporal.Instant.from(after.toISOString()) : after.toInstant();
|
|
592
|
-
let
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
const
|
|
596
|
-
if (
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
matchCount++;
|
|
600
|
-
if (this.opts.count !== void 0 && matchCount >= this.opts.count) {
|
|
601
|
-
return null;
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
if (this.opts.until && Temporal.ZonedDateTime.compare(current, this.opts.until) >= 0) {
|
|
605
|
-
return null;
|
|
592
|
+
let result = null;
|
|
593
|
+
this.all((occ) => {
|
|
594
|
+
const inst = occ.toInstant();
|
|
595
|
+
const ok = inc ? Temporal.Instant.compare(inst, afterInst) >= 0 : Temporal.Instant.compare(inst, afterInst) > 0;
|
|
596
|
+
if (ok) {
|
|
597
|
+
result = occ;
|
|
598
|
+
return false;
|
|
606
599
|
}
|
|
607
|
-
|
|
608
|
-
}
|
|
600
|
+
return true;
|
|
601
|
+
});
|
|
602
|
+
return result;
|
|
609
603
|
}
|
|
610
604
|
/**
|
|
611
605
|
* Returns the previous occurrence of the rule before a specified date.
|
|
@@ -615,21 +609,14 @@ var RRuleTemporal = class {
|
|
|
615
609
|
*/
|
|
616
610
|
previous(before = /* @__PURE__ */ new Date(), inc = false) {
|
|
617
611
|
const beforeInst = before instanceof Date ? Temporal.Instant.from(before.toISOString()) : before.toInstant();
|
|
618
|
-
let current = this.computeFirst();
|
|
619
612
|
let prev = null;
|
|
620
|
-
|
|
621
|
-
const inst =
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
}
|
|
628
|
-
if (this.opts.until && Temporal.ZonedDateTime.compare(current, this.opts.until) >= 0) {
|
|
629
|
-
break;
|
|
630
|
-
}
|
|
631
|
-
current = this.nextCandidateSameDate(current);
|
|
632
|
-
}
|
|
613
|
+
this.all((occ) => {
|
|
614
|
+
const inst = occ.toInstant();
|
|
615
|
+
const beyond = inc ? Temporal.Instant.compare(inst, beforeInst) > 0 : Temporal.Instant.compare(inst, beforeInst) >= 0;
|
|
616
|
+
if (beyond) return false;
|
|
617
|
+
prev = occ;
|
|
618
|
+
return true;
|
|
619
|
+
});
|
|
633
620
|
return prev;
|
|
634
621
|
}
|
|
635
622
|
toString() {
|