ical.js icon indicating copy to clipboard operation
ical.js copied to clipboard

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

Open moll opened this issue 8 years ago • 4 comments

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

moll avatar Jan 17 '17 10:01 moll

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.

kewisch avatar Jan 17 '17 12:01 kewisch

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 avatar Jan 17 '17 12:01 moll

I clarified the title a little, too.

moll avatar Jan 17 '17 12:01 moll

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

kewisch avatar Jan 17 '17 13:01 kewisch

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.

kewisch avatar May 01 '24 07:05 kewisch

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.

github-actions[bot] avatar Jun 01 '24 00:06 github-actions[bot]