Skip to content

Commit

Permalink
Merge pull request #128 from joostdebruijn/joost/fix-dtendfullday
Browse files Browse the repository at this point in the history
fix: dtend for full day events should be on the next day at midnight
  • Loading branch information
rubenvanassche authored May 8, 2024
2 parents 65347d8 + 7ab5476 commit 60bb7fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/Components/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 60bb7fd

Please sign in to comment.