Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/pipeline/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ export function formatEvent(attributes = {}) {
classification,
created,
lastModified,
htmlContent
htmlContent,
recurrenceId
} = attributes

let icsFormat = ''
Expand Down Expand Up @@ -111,6 +112,8 @@ export function formatEvent(attributes = {}) {
icsFormat += setAlarm(alarm)
})
}
icsFormat += recurrenceId ? foldLine(`RECURRENCE-ID:${encodeNewLines(formatDate(recurrenceId))}`) + "\r\n" : "";

icsFormat += `END:VEVENT\r\n`

return icsFormat
Expand Down
3 changes: 2 additions & 1 deletion src/schema/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ const eventShape = {
created: dateTimeSchema({ required: false }),
lastModified: dateTimeSchema({ required: false }),
exclusionDates: yup.array().of(dateTimeSchema({ required: true })),
htmlContent: yup.string()
htmlContent: yup.string(),
recurrenceId : dateTimeSchema({ required: false })
}

const headerAndEventSchema = yup.object().shape({ ...headerShape, ...eventShape }).test('xor', `object should have end or duration (but not both)`, val => {
Expand Down
12 changes: 12 additions & 0 deletions test/pipeline/format.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,4 +327,16 @@ describe('pipeline.formatEvent', () => {
})
expect(formattedEvent).to.contain('EXDATE:20000620T010000Z,20000621T010000Z')
})
it("writes recurrence ID", () => {
const event = {
uid:"uid",
title: "Test Event",
start: [2023, 5, 15, 10, 0],
end: [2023, 5, 15, 11, 0],
recurrenceId: [2023, 5, 15, 10, 0],
};

const result = formatEvent(event);
expect(result).to.contain("RECURRENCE-ID:20230515T100000Z");
});
})