Skip to content

Commit

Permalink
Cast dateTime objects returned from DatePeriod to carbon instances
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com>
  • Loading branch information
sampoyigi committed Aug 16, 2022
1 parent 9b298e9 commit 99d4355
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Location/WorkingSchedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ public function getTimeslot(int $interval = 15, DateTime $dateTime = null, int $
$datePeriod = $this->createPeriodForDays($dateTime);

foreach ($datePeriod ?: [] as $date) {
$dateString = $date->toDateString();
$dateString = Carbon::instance($date)->toDateString();

$periodTimeslot = $this->forDate($date)
->timeslot($date, $interval, $leadTime)
Expand Down Expand Up @@ -484,7 +484,7 @@ protected function createPeriodForDays($dateTime)

protected function isBetweenPeriodForDays($timeslot)
{
return $timeslot->between(
return Carbon::instance($timeslot)->between(
now()->startOfDay()->addDays($this->minDays),
now()->endOfDay()->addDays($this->maxDays + 2)
);
Expand Down

0 comments on commit 99d4355

Please sign in to comment.