jkbrzt / rrule

JavaScript library for working with recurrence rules for calendar dates as defined in the iCalendar RFC and more.
https://jkbrzt.github.io/rrule
Other
3.33k stars 511 forks source link

Error Parsong RRule String in EXDATE #342

Closed vkiranmaniya closed 5 years ago

vkiranmaniya commented 5 years ago

Reporting an issue

I'm Trying to Parse the Recurrence rules coming from Wordpress JSON API. Here is the sample rule FREQ=WEEKLY;WKST=SU;BYday=SU;EXDATE=20191229T000000Z But it shows error that EXDATE is not valid propery

Here is the stack trace of my react native app

Unknown RRULE property 'EXDATE' Stack trace: node_modules\rrule\dist\es5\rrule.js:1053:32 in <unknown> node_modules\rrule\dist\es5\rrule.js:1011:18 in parseRrule node_modules\rrule\dist\es5\rrule.js:972:44 in parseString node_modules\rrule\dist\es5\rrule.js:2006:43 in fromString screens\WhatsOnScreen.js:107:61 in <unknown> screens\WhatsOnScreen.js:88:42 in <unknown> node_modules\promise\setimmediate\core.js:37:14 in tryCallOne node_modules\promise\setimmediate\core.js:123:25 in <unknown> ...

I also gave a try to your demo, but it's not working

davidgoli commented 5 years ago

That syntax is incorrect. EXDATE isn't an RRULE prop, it's its own prop. Correct syntax should be:

DTSTART:...
RRULE:FREQ=WEEKLY;...
EXDATE:...

See https://tools.ietf.org/html/rfc5545#section-3.8.5.1 for more clarification.