Skip to content

Commit

Permalink
fix: appointment slots start and end time
Browse files Browse the repository at this point in the history
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
  • Loading branch information
SebastianKrupinski committed Nov 16, 2024
1 parent 9eb17f3 commit b3edcfa
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lib/Controller/BookingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,11 @@ public function getBookableSlots(int $appointmentConfigId,
$this->logger->error('Timezone invalid', ['exception' => $e]);
return JsonResponse::fail('Invalid time zone', Http::STATUS_UNPROCESSABLE_ENTITY);
}
$startTimeInTz = (new DateTimeImmutable())
->setTimestamp($startTime)
->setTimezone($tz)
->setTime(0, 0)

$startTimeInTz = (new DateTimeImmutable("@$startTime", $tz))
->getTimestamp();
$endTimeInTz = (new DateTimeImmutable())
->setTimestamp($startTime)
->setTimezone($tz)
->setTime(23, 59, 59)
$endTimeInTz = (new DateTimeImmutable("@$startTime", $tz))
->modify('+1 day')
->getTimestamp();

if ($startTimeInTz > $endTimeInTz) {
Expand Down

0 comments on commit b3edcfa

Please sign in to comment.