Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 5 additions & 3 deletions src/Tags/Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/Types/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down