ics icon indicating copy to clipboard operation
ics copied to clipboard

Type issue for organizer attribute

Open derhyl opened this issue 1 year ago • 2 comments

Hi,

It seems that you have a ts type issue on organizer Field.

This is your type definition export type Person = { name?: string; email?: string; dir?: string; };

This is the standard : https://www.kanzaki.com/docs/ical/calAddress.html

It seems that email address is actually required.

In consequence, the ics generates but is not importable on google cal or outlook because it's considered corrupted.

Can you please update your type definitions?

Thanks

derhyl avatar Oct 21 '22 10:10 derhyl

Hi,

the same issue appeared as well on the attendees field for the mentioned calendars (Google Calendar, Outlook). However, the ics file can be imported into apple Calendar. but, it shows ERROR where the attendees list should be shown, because of a missing email field!

image-20221219-101305 (1)

are there any updates regarding this issue? Thanks!

nurjinjafar avatar Jan 03 '23 20:01 nurjinjafar

Waiting for a fix, here is our workaround :

// Here is the specification for ics organizer : https://www.rfc-editor.org/rfc/rfc5545#section-3.8.4.3:~:text=the%20following%0A%20%20%20%20%20%20notation%3A-,organizer,-%3D%20%22ORGANIZER%22%20orgparam%20%22%3A%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20cal
// ICS generated by ics package is not compliant with the RFC5545 as spotted in the issue : https://github.com/adamgibbons/ics/issues/224
// even without this mailto option, the delimiter ':' should be set
export function fixIcsOrganizer(icsString: string): string {
  return icsString.replace(/ORGANIZER;CN=(.*?[^:])\r\n/, (_, organizerName) => {
    return `ORGANIZER;CN=${organizerName}:\r\n`
  })
}

Vincent-Maret avatar Mar 29 '24 14:03 Vincent-Maret