Skip to content

Commit

Permalink
Fix outlook and all day.
Browse files Browse the repository at this point in the history
  • Loading branch information
vever001 committed Feb 6, 2024
1 parent 6b9ca16 commit 7f22da7
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/Generators/BaseOutlook.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,15 @@ public function generate(Link $link): string
{
$url = $this->baseUrl();

$dateTimeFormat = $link->allDay ? $this->dateFormat : $this->dateTimeFormat;

$utcStartDateTime = (clone $link->from)->setTimezone(new DateTimeZone('UTC'));
$utcEndDateTime = (clone $link->to)->setTimezone(new DateTimeZone('UTC'));

$url .= '&startdt='.$utcStartDateTime->format($dateTimeFormat);
$url .= '&enddt='.$utcEndDateTime->format($dateTimeFormat);

if ($link->allDay) {
$url .= '&startdt='.$link->from->format($this->dateFormat);
$url .= '&enddt='.$link->to->format($this->dateFormat);
$url .= '&allday=true';
}
else {
$url .= '&startdt='.(clone $link->from)->setTimezone(new DateTimeZone('UTC'))->format($this->dateTimeFormat);
$url .= '&enddt='.(clone $link->to)->setTimezone(new DateTimeZone('UTC'))->format($this->dateTimeFormat);
}

$url .= '&subject='.$this->sanitizeString($link->title);

Expand Down

0 comments on commit 7f22da7

Please sign in to comment.