kewisch / kewisch/ical.js

DTSTART/DTEND with incorrect DATE-TIME should fail hard on parse instead of serializing to `T::`

Open
#620 3 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
1.2k
Forks
156
Avg merge
4d 43m
Merged PRs (30d)
3

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:d014056281520fcbfa723cc54afb2219@tools.ref-nidau.ch
DTSTAMP:20230912T115144Z
LAST-MODIFIED:20230523T064918Z
SUMMARY:Kinderwoche
DESCRIPTION:
DTSTART:20231008
DTEND:20231013
LOCATION:Mylocation
ORGANIZER:mailto:no-reply@ref-nidau.ch
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:57ca41befa1a99212de0929668d48329@tools.ref-nidau.ch
DTSTAMP:20230912T100054Z
LAST-MODIFIED:20230523T064918Z
SUMMARY:Kinderwoche
DESCRIPTION:
DTSTART:2023-10-08T::
DTEND:2023-10-13T::
LOCATION:Mylocation
ORGANIZER:mailto:no-reply@ref-nidau.ch
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
});
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the supplied VCALENDAR with ical.js, then follow the parser and the component toString() path for the DTSTART and DTEND values. Confirm that the date-only values are rejected during parsing rather than emitted as 2023-10-08T:: and 2023-10-13T::, with coverage demonstrating the expected hard failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.