Skip to content

Commit

Permalink
use end time (fixes #27)
Browse files Browse the repository at this point in the history
  • Loading branch information
edalzell committed Mar 11, 2020
1 parent 0a02e76 commit 56152c3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Events/Types/SingleDayEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ public function datesBetween($from, $to): Collection
$start = $this->start();

if ($start->between(carbon($from), carbon($to))) {
return collect([Schedule::fromCarbon($start)]);
$day = new Schedule([
'date' => $this->start_date,
'start_time' => $this->startTime(),
'end_time' => $this->endTime(),
]);

return collect([$day]);
}

return collect([]);
Expand Down
2 changes: 2 additions & 0 deletions Events/tests/SingleDayEventsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,15 @@ public function test_can_generate_between_dates()

$dates = collect([
carbon('2019-11-27 11:00'),
carbon('2019-11-27 12:00'),
]);

$nextDates = $this->nonAllDayEvent->datesBetween(carbon('2019-11-26'), carbon('2019-11-28'));

$this->assertCount(1, $nextDates);

$this->assertEquals($dates[0], $nextDates[0]->start());
$this->assertEquals($dates[1], $nextDates[0]->end());

$this->assertEmpty(
$this->allDayEvent->datesBetween(carbon('2019-11-28'), carbon('2019-11-29'))
Expand Down

0 comments on commit 56152c3

Please sign in to comment.