From ca52065f661e6c495e8c8825e88dd2c4f635ef36 Mon Sep 17 00:00:00 2001 From: Ryan Mwangi Date: Tue, 19 Nov 2024 14:03:42 +0300 Subject: [PATCH] feat(calendar): include CALSCALE and SEQUENCE details --- src/calendarUtil.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/calendarUtil.js b/src/calendarUtil.js index 745dc07..f883251 100644 --- a/src/calendarUtil.js +++ b/src/calendarUtil.js @@ -31,6 +31,7 @@ export function createCalendarComponent(name) { const calendarComponent = new ICAL.Component(['vcalendar', [], []]); calendarComponent.updatePropertyWithValue('name', name); calendarComponent.updatePropertyWithValue('version', '2.0'); + calendarComponent.updatePropertyWithValue('calscale', 'GREGORIAN'); calendarComponent.updatePropertyWithValue('prodid', '-//CalMerge//Calendar Merger 1.0//EN'); return calendarComponent; } @@ -103,10 +104,14 @@ export function addEventsToCalendar(calendarComponent, results, overrideFlag = f const recurrenceId = event.getFirstPropertyValue('recurrence-id'); if (recurrenceId) newEvent.updatePropertyWithValue('recurrence-id', recurrenceId); - // 6. Copy SUMMARY + // 6. Add SEQUENCE (if available or default to 0) + const sequence = event.getFirstPropertyValue('sequence') || 0; + newEvent.updatePropertyWithValue('sequence', sequence); + + // 7. Copy SUMMARY newEvent.updatePropertyWithValue('summary', vevent.summary.trim()); - // 7. Copy UID + // 8. Copy UID newEvent.updatePropertyWithValue('uid', vevent.uid); // Add the VEVENT to the calendar