Open
Description
ical.js in version 1.5.0
On windows 11 and debian with nodejs version 16
Importing this ical file works fine:
BEGIN:VCALENDAR
PRODID:-//eluceo/ical//2.0/EN
VERSION:2.0
CALSCALE:GREGORIAN
X-PUBLISHED-TTL:PT1H
X-WR-CALNAME:Calname
BEGIN:VEVENT
UID:[email protected]
DTSTAMP:20230912T115144Z
LAST-MODIFIED:20230523T064918Z
SUMMARY:Kinderwoche
DESCRIPTION:
DTSTART:20231008
DTEND:20231013
LOCATION:Mylocation
ORGANIZER:mailto:[email protected]
SEQUENCE:1
X-MICROSOFT-CDO-ALLDAYEVENT:TRUE
END:VEVENT
END:VCALENDAR
But when I export it back out, the all day events with no time have an invalid time part in the ics file/content
The DTSTART and DTEND fierlds/values have a completely different format, with - delimiters and T:: at the end.
BEGIN:VCALENDAR
PRODID:-//iCal.js churchtool calendar merger
VERSION:2.0
CALSCALE:GREGORIAN
BEGIN:VEVENT
UID:[email protected]
DTSTAMP:20230912T100054Z
LAST-MODIFIED:20230523T064918Z
SUMMARY:Kinderwoche
DESCRIPTION:
DTSTART:2023-10-08T::
DTEND:2023-10-13T::
LOCATION:Mylocation
ORGANIZER:mailto:[email protected]
SEQUENCE:1
X-MICROSOFT-CDO-ALLDAYEVENT:TRUE
END:VEVENT
END:VCALENDAR
ee use the toString() method to produce the ical file/content
let comp = new ICAL.Component(['vcalendar', [], []]);
comp.updatePropertyWithValue('prodid', '-//iCal.js churchtool calendar merger');
comp.updatePropertyWithValue('version', '2.0');
comp.updatePropertyWithValue('calscale', 'GREGORIAN');
for (const srcEvent of newCalendarContent[key]) {
// Add the components from imported ical
comp.addSubcomponent(srcEvent);
}
logger.info("Output to: "+singleConfig.output.fileName);
fs.writeFile(singleConfig.output.fileName, comp.toString(), err => {
if (err) {
console.error(err);
}
// file written successfully
});