query->get('start'); $end = $request->query->get('end'); if (!$start || !$end) { // Default to current month if not specified $now = new \DateTimeImmutable(); $start = $now->modify('first day of this month')->setTime(0, 0); $end = $now->modify('last day of this month')->setTime(23, 59, 59); } else { $start = new \DateTimeImmutable($start); $end = new \DateTimeImmutable($end); } $events = $this->eventRepository->findByDateRange($start, $end); return $this->json([ 'events' => $events, ]); } }