Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Types/MultiDayEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public function __construct(Entry $event, private bool $collapseMultiDays)
parent::__construct($event);

$this->days = collect($this->event->days)
->sortBy('date')
->map(fn (Values $day) => new Day(
$day->all(),
$this->timezone['timezone'],
Expand Down
27 changes: 22 additions & 5 deletions tests/Unit/MultiDayEventsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ protected function setUp(): void
->data([
'recurrence' => 'multi_day',
'days' => [
[
'date' => '2019-11-23',
'start_time' => '19:00',
'end_time' => '21:00',
],
[
'date' => '2019-11-24',
'start_time' => '11:00',
Expand All @@ -47,6 +42,11 @@ protected function setUp(): void
'start_time' => '11:00',
'end_time' => '15:00',
],
[
'date' => '2019-11-23',
'start_time' => '19:00',
'end_time' => '21:00',
],
],
'timezone' => 'America/Vancouver',
]);
Expand Down Expand Up @@ -118,6 +118,23 @@ public function canGetStart()
);
}

#[Test]
public function canGetEnd()
{
$this->assertEquals(
Carbon::parse('2019-11-25 15:00')->shiftTimezone('America/Vancouver'),
$this->event->end()
);
$this->assertEquals(
Carbon::parse('2019-11-21 23:59:59.999999')->shiftTimezone('America/Vancouver'),
$this->allDayEvent->end()
);
$this->assertEquals(
Carbon::parse('2019-11-21 23:59:00')->shiftTimezone('America/Vancouver')->timezone,
$this->event->end()->timezone
);
}

#[Test]
public function noOccurrencesIfNowAfterEndDate()
{
Expand Down