This commit is contained in:
James Cole
2019-09-26 19:16:17 +02:00
parent f370a1b486
commit 3ff8aa7509
4 changed files with 284 additions and 5 deletions

View File

@@ -125,9 +125,6 @@ class RecurrenceTransformer extends AbstractTransformer
private function getRepetitions(Recurrence $recurrence): array
{
$fromDate = $recurrence->latest_date ?? $recurrence->first_date;
// date in the past? use today:
$today = new Carbon;
$fromDate = $fromDate->lte($today) ? $today : $fromDate;
$return = [];
/** @var RecurrenceRepetition $repetition */
@@ -145,7 +142,7 @@ class RecurrenceTransformer extends AbstractTransformer
];
// get the (future) occurrences for this specific type of repetition:
$occurrences = $this->repository->getXOccurrences($repetition, $fromDate, 5);
$occurrences = $this->repository->getXOccurrencesSince($repetition, $fromDate, new Carbon, 5);
/** @var Carbon $carbon */
foreach ($occurrences as $carbon) {
$repetitionArray['occurrences'][] = $carbon->format('Y-m-d');