Skip to content

Commit

Permalink
Merge pull request #202 from giacomovernoni/fix-ics-alert
Browse files Browse the repository at this point in the history
Fix ics alert not working when a date is set
  • Loading branch information
alies-dev authored Jan 16, 2025
2 parents 1178fda + fa847d9 commit 2d61d85
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
build
composer.lock
docs
Expand Down
6 changes: 3 additions & 3 deletions src/Generators/Ics.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,16 @@ private function generateAlertComponent(Link $link): array
$description = 'Reminder: '.$this->escapeString($link->title);
}

$trigger = '-PT15M';
$trigger = 'TRIGGER:-PT15M';
if (($reminderTime = $this->options['REMINDER']['TIME'] ?? null) instanceof \DateTimeInterface) {
$trigger = 'VALUE=DATE-TIME:'.gmdate($this->dateTimeFormat, $reminderTime->getTimestamp());
$trigger = 'TRIGGER;VALUE=DATE-TIME:'.gmdate($this->dateTimeFormat, $reminderTime->getTimestamp());
}

$alarmComponent = [];
$alarmComponent[] = 'BEGIN:VALARM';
$alarmComponent[] = 'ACTION:DISPLAY';
$alarmComponent[] = 'DESCRIPTION:'.$description;
$alarmComponent[] = 'TRIGGER:'.$trigger;
$alarmComponent[] = $trigger;
$alarmComponent[] = 'END:VALARM';

return $alarmComponent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ LOCATION:Party Lane 1A\, 1337 Funtown
BEGIN:VALARM
ACTION:DISPLAY
DESCRIPTION:Party with balloons and cake!
TRIGGER:VALUE=DATE-TIME:20180201T081500Z
TRIGGER;VALUE=DATE-TIME:20180201T081500Z
END:VALARM
END:VEVENT
END:VCALENDAR

0 comments on commit 2d61d85

Please sign in to comment.