Skip to content

Commit

Permalink
Fix ics alert not working when a date is set
Browse files Browse the repository at this point in the history
(cherry picked from commit fa847d9)
  • Loading branch information
giacomovernoni authored and alies-dev committed Jan 16, 2025
1 parent 4f229b9 commit bf4645d
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 @@ -125,16 +125,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 bf4645d

Please sign in to comment.