From 0c16f34804a94240f3e29f7e3ca622a8559b26ff Mon Sep 17 00:00:00 2001 From: kevinkosterr Date: Fri, 10 Apr 2026 14:37:27 +0200 Subject: [PATCH] fix: events:between missing limit param --- src/Events.php | 2 +- src/Tags/Events.php | 8 +++++--- src/Types/Event.php | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Events.php b/src/Events.php index d05c350..2415195 100644 --- a/src/Events.php +++ b/src/Events.php @@ -145,7 +145,7 @@ public function terms(string|array $terms): self return $this; } - public function between(string|CarbonInterface $from, string|CarbonInterface $to): EntryCollection|LengthAwarePaginator + public function between(string|CarbonInterface $from, string|CarbonInterface $to, int $limit = null): EntryCollection|LengthAwarePaginator { return $this->output( type: fn (Entry $entry) => EventFactory::createFromEntry(event: $entry, collapseMultiDays: $this->collapseMultiDays)->occurrencesBetween(from: $from, to: $to) diff --git a/src/Tags/Events.php b/src/Tags/Events.php index 277c407..ef4e840 100755 --- a/src/Tags/Events.php +++ b/src/Tags/Events.php @@ -24,10 +24,12 @@ class Events extends Tags public function between(): EntryCollection|array { - return $this->output($this->generator()->between( + $occurrences = $this->generator()->between( from: CarbonImmutable::parse($this->params->get('from', now()))->startOfDay(), - to: CarbonImmutable::parse($this->params->get('to'))->endOfDay() - )); + to: CarbonImmutable::parse($this->params->get('to'))->endOfDay(), + limit: $this->params->int('limit') + ); + return $this->output($occurrences); } public function calendar(): Collection diff --git a/src/Types/Event.php b/src/Types/Event.php index 8728ae6..25a9fa4 100644 --- a/src/Types/Event.php +++ b/src/Types/Event.php @@ -62,9 +62,9 @@ public function isRecurring(): bool }; } - public function occurrencesBetween(string|CarbonInterface $from, string|CarbonInterface $to): Collection + public function occurrencesBetween(string|CarbonInterface $from, string|CarbonInterface $to, int $limit = null): Collection { - return $this->collect($this->rule()->getOccurrencesBetween(begin: $from, end: $to)); + return $this->collect($this->rule()->getOccurrencesBetween(begin: $from, end: $to, limit: $limit)); } public function occursOnDate(string|CarbonInterface $date): bool