kewisch / ical.js

Javascript parser for ics (rfc5545) and vcard (rfc6350) data
https://kewisch.github.io/ical.js/
Mozilla Public License 2.0
991 stars 137 forks source link

Ical.parse returns RRULE with WKST as a number, not a string as in RFC 7265 #284

Closed moll closed 3 months ago

moll commented 7 years ago

Hey,

Correct me if I'm wrong, but isn't Ical.parse supposed to parse to a jCal (RFC 7265) compatible object? It seems to do so with the exception of RRULE's WKST which is returned as number and not a string as the RFC states. This just tripped me up, especially because it's a peculiar offset-from-1 enum.

Cheers

kewisch commented 7 years ago

ICAL.parse() is supposed to parse rfc5545 or rfc6350 data. If you already have jCal data, you can just use new ICAL.Component(jcaldata); I'm surprised ICAL.parse would parse jcal data, I guess it would be smart to throw in this case.

moll commented 7 years ago

Correct me if I'm wrong, but isn't Ical.parse supposed to parse to a jCal (RFC 7265) compatible object?

I am giving it a string in RFC 5545. What I mean is that the RFC 7265 format it returns (hence the "to a" in the sentence above") isn't RFC-compatible because of the numeric WKST.

moll commented 7 years ago

I clarified the title a little, too.

kewisch commented 7 years ago

Ah yes, sorry I misread! In that case this sounds like a valid bug!

kewisch commented 4 months ago

Ok, many years later I've taken a look at this. Technically what happens is correct. ICAL.parse will create an ICAL.Recur object, which has a wkst member, but that is not expected to be a string. I can imagine the reasoning was that numbers are quicker to compare, though you could argue the string/number conversion eats it up in some situations.

If you call recur.toJSON() you will get a valid rfc7265 part of the jCal that uses a string for the wkst.

If there is something we can improve in the documentation around this let me know.

github-actions[bot] commented 3 months ago

It looks like we haven't heard back on this issue, therefore we are closing this issue. If this problem persists in the latest version of ical.js, please re-open this issue.