iCal
iCal copied to clipboard
Calendar app on the Mac does not accept this ics.
When i try to import a downloaded .ics file with this content, no calendar item is imported in the calendar
BEGIN:VCALENDAR PRODID:platform VERSION:2.0 CALSCALE:GREGORIAN BEGIN:VEVENT UID:94b10624-55ac-4974-b87d-48408e89a841 DTSTAMP:20220302T084901Z SUMMARY:testx DESCRIPTION:Join: https://test.nl DTSTART;UTC=:20220303T083800 DTEND;TZID=UTC:20220303T093800 ORGANIZER:mailto:test%40test.io SEQUENCE:0 DURATION:P0DT1H0M0S END:VEVENT END:VCALENDAR
Are there any suggestions?
Can you show us the minimal working PHP code that is needed to create this ICS output? Which version of this library do you use?
HI Thank you very much for your quick response..
We use version 2.5.0
This is the code we use to generate the .ics
/** @param array<Shortcode> $shortcodes */
public function generatePersonal(
Meeting $meeting,
User $recipient,
string $type,
array $shortcodes
): string {
$attendee = new Attendee(new EmailAddress($recipient->getEmailaddress()));
$vEvent = $this->createEvent($meeting);
$vEvent
->addAttendee($attendee)
->setDescription($this->getEmailBody($recipient, $shortcodes, $type))
;
if ($meeting->isCancelled()) {
$vEvent->setMethod('CANCEL');
$vEvent->setStatus('CANCELLED');
}
$vCalendar = new Calendar([$vEvent]);
$vCalendar->setProductIdentifier('test-platform');
$vCalendarComponent = (new CalendarFactory(new MeetingEventFactory()))->createCalendar($vCalendar);
return (string) $vCalendarComponent;
}
private function createEvent(Meeting $meeting): MeetingEvent
{
$vEvent = new MeetingEvent(new UniqueIdentifier($meeting->getMeetingId()->toString()));
$vEvent
->setSequence($meeting->getVersion())
->setDuration($meeting->getEstimatedDuration())
->setSummary($meeting->getTitle())
->setOccurrence(new TimeSpan(
new DateTime($meeting->getScheduledAt(), true),
new DateTime($meeting->getEstimatedEndTime(), true)
))
->touch(new Timestamp(new DateTimeImmutable()))
->setOrganizer($this->getOrganizer())
;
return $vEvent;
}
If you need more info please let me know.
Thanks very much in advance
I'm having the same issue - generating a very simple ICS file does not work in mobile safari on my iPhone 8. Instead it prompts me to "download cal.ics.html". I'm using a very standard event with little information, see following ical file:
BEGIN:VCALENDAR
PRODID:-//eluceo/ical//2.0/EN
VERSION:2.0
CALSCALE:GREGORIAN
BEGIN:VEVENT
UID:e48b646f1d49a5102a8e72d8ad711b63
DTSTAMP:20220313T225532Z
SUMMARY:My Event Title
DESCRIPTION:https://www.mydomain.com/some/link
DTSTART:20221021T180000
DTEND:20221021T210000
ORGANIZER;CN=My Organizer Name:mailto:info%40mydomain.com
END:VEVENT
END:VCALENDAR
When generating, I'm writing these headers:
header('Content-Type: text/calendar; charset=utf-8');
header('Content-Disposition: attachment; filename="cal.ics"');
Update: I tested this on various platforms including Mac, and it works fine on Mac OSX, but simply not at all mobile on iOS 15.3.1.
This may be caused by #434, which has a fix in #444.
Thanks for raising this issue.
This bug will be fixed in https://github.com/markuspoerschke/iCal/pull/479.