adamgibbons / ics

iCalendar (ics) file generator for node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Classification (CLASS) attribute missing from VEVENT

stanool opened this issue · comments

According to https://www.kanzaki.com/docs/ical/class.html the VEVENT block of an ICS file can have a single CLASS attribute representing the 'Classification' of the VEVENT (eg, public, private, confidential).

I believe this would be fairly straightforward to implement, eg, create a property classification on the attributes object in formatEvent, add

icsFormat += classification ? (foldLine(`CLASS:${classification}`) + '\r\n') : '' 

when building the ICS string, and add a Typescript property (either string or PUBLIC | PRIVATE | CONFIDENTIAL).

It should be enough that this test should pass:

  it('writes a classification', () => {
    const event = buildEvent({ classification: 'PUBLIC'})
    const formattedEvent = formatEvent(event)

    expect(formattedEvent).to.contain('CLASS:PUBLIC')
  })

There could be more checks like there is only one instance of CLASS inside a VEVENT block but the above should suffice.

I also came across that this one seems to be missing

Closed with #203 - thanks @Flowr-es!