missing changes
This commit is contained in:
Родитель
5d2ed7b785
Коммит
d3281a5b83
|
@ -128,10 +128,13 @@ class OptionController extends Controller {
|
|||
*/
|
||||
public function findCalendarEvents($optionId): DataResponse {
|
||||
return $this->response(function () use ($optionId) {
|
||||
$option = $this->optionService->get($optionId);
|
||||
$searchFrom = new DateTime();
|
||||
$searchFrom = $searchFrom->setTimestamp($this->optionService->get($optionId)->getTimestamp())->sub(new DateInterval('PT1H'));
|
||||
$searchTo = clone $searchFrom;
|
||||
$searchTo = $searchTo->add(new DateInterval('PT3H'));
|
||||
$searchTo = new DateTime();
|
||||
// Search calendar entries which end inside one hour before option start time
|
||||
$searchFrom = $searchFrom->setTimestamp($option->getTimestamp())->sub(new DateInterval('PT1H'));
|
||||
// Search calendar entries which start inside one hour after option end time
|
||||
$searchTo = $searchTo->setTimestamp($option->getTimestamp() + $option->getDuration())->add(new DateInterval('PT1H'));
|
||||
$events = $this->calendarService->getEvents($searchFrom, $searchTo);
|
||||
return ['events' => $events];
|
||||
});
|
||||
|
|
|
@ -73,7 +73,7 @@ class CalendarService {
|
|||
|
||||
// since we get back recurring events of other days, just make sure this event
|
||||
// matches the search pattern
|
||||
// TODO: identify possible time zone issues, whan handling all day events
|
||||
// TODO: identify possible time zone issues, when handling all day events
|
||||
if (($from->getTimestamp() < $calendarEvent->getEnd())
|
||||
&& ($to->getTimestamp() > $calendarEvent->getStart())) {
|
||||
array_push($events, $calendarEvent);
|
||||
|
|
Загрузка…
Ссылка в новой задаче