Skip to content

Commit bf4645d

Browse files
giacomovernonialies-dev
authored andcommitted
Fix ics alert not working when a date is set
(cherry picked from commit fa847d9)
1 parent 4f229b9 commit bf4645d

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.idea
12
build
23
composer.lock
34
docs

src/Generators/Ics.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,16 @@ private function generateAlertComponent(Link $link): array
125125
$description = 'Reminder: '.$this->escapeString($link->title);
126126
}
127127

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

133133
$alarmComponent = [];
134134
$alarmComponent[] = 'BEGIN:VALARM';
135135
$alarmComponent[] = 'ACTION:DISPLAY';
136136
$alarmComponent[] = 'DESCRIPTION:'.$description;
137-
$alarmComponent[] = 'TRIGGER:'.$trigger;
137+
$alarmComponent[] = $trigger;
138138
$alarmComponent[] = 'END:VALARM';
139139

140140
return $alarmComponent;

tests/Generators/__snapshots__/IcsGeneratorTest__it_can_generate_with_a_custom_reminder__1.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LOCATION:Party Lane 1A\, 1337 Funtown
1212
BEGIN:VALARM
1313
ACTION:DISPLAY
1414
DESCRIPTION:Party with balloons and cake!
15-
TRIGGER:VALUE=DATE-TIME:20180201T081500Z
15+
TRIGGER;VALUE=DATE-TIME:20180201T081500Z
1616
END:VALARM
1717
END:VEVENT
1818
END:VCALENDAR

0 commit comments

Comments
 (0)