diff --git a/src/Components/Event.php b/src/Components/Event.php index 9387834..bf7a450 100644 --- a/src/Components/Event.php +++ b/src/Components/Event.php @@ -127,7 +127,14 @@ public function startsAt(DateTimeInterface $starts, bool $withTime = true): Even public function endsAt(DateTimeInterface $ends, bool $withTime = true): Event { - $this->ends = DateTimeValue::create($ends, $withTime); + if ($this->isFullDay) { + // The DTEND is the non-inclusive end of the event. + $ends = $ends->modify('+1 day'); + $this->ends = DateTimeValue::create($ends, false); + } else { + $this->ends = DateTimeValue::create($ends, $withTime); + } + return $this; } diff --git a/tests/__snapshots__/IntegrationTest__it_can_create_a_full_day_event__1.txt b/tests/__snapshots__/IntegrationTest__it_can_create_a_full_day_event__1.txt index 94fdbc0..cf086b4 100644 --- a/tests/__snapshots__/IntegrationTest__it_can_create_a_full_day_event__1.txt +++ b/tests/__snapshots__/IntegrationTest__it_can_create_a_full_day_event__1.txt @@ -8,6 +8,6 @@ UID:uuid_2 DTSTAMP:20190306T150000Z SUMMARY:Laracon online DTSTART;VALUE=DATE:20190306 -DTEND;VALUE=DATE:20190306 +DTEND;VALUE=DATE:20190307 END:VEVENT END:VCALENDAR \ No newline at end of file