ends_at ?? ($event->all_day ? $event->starts_at : $event->starts_at->copy()->addHour()); $lines = [ 'BEGIN:VCALENDAR', 'VERSION:2.0', 'PRODID:-//'.$this->escape($organizer).'//Inhaus//DE', 'CALSCALE:GREGORIAN', 'METHOD:PUBLISH', 'BEGIN:VEVENT', 'UID:event-'.$event->id.'@'.(parse_url(config('app.url'), PHP_URL_HOST) ?: 'inhaus'), 'DTSTAMP:'.now()->utc()->format('Ymd\THis\Z'), ]; if ($event->all_day) { $lines[] = 'DTSTART;VALUE=DATE:'.$event->starts_at->format('Ymd'); // DTEND ist bei ganztägigen Terminen exklusiv: der Tag nach dem letzten Tag. $lines[] = 'DTEND;VALUE=DATE:'.$end->copy()->startOfDay()->addDay()->format('Ymd'); } else { $lines[] = 'DTSTART:'.$event->starts_at->copy()->utc()->format('Ymd\THis\Z'); $lines[] = 'DTEND:'.$end->copy()->utc()->format('Ymd\THis\Z'); } $lines[] = 'SUMMARY:'.$this->escape($event->title); if ($event->location) { $lines[] = 'LOCATION:'.$this->escape($event->location); } $description = trim(html_entity_decode(strip_tags(str_replace(['
', '