Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsupported RFC prop EXDATE in EXDATE;TZID=America/New_York:20180921T130000 #335

Closed
4 tasks done
agordeev opened this issue Apr 3, 2019 · 1 comment
Closed
4 tasks done

Comments

@agordeev
Copy link

agordeev commented Apr 3, 2019

Reporting an issue

Thank you for taking an interest in rrule! Please include the following in
your report:

  • Verify that you've looked through existing issues for duplicates before
    creating a new one
  • Code sample reproducing the issue. Be sure to include all input values you
    are using such as the exact RRule string and dates.

The lib is unable to parse this rule:

[ 'DTSTART:20180323T170000Z',
  'EXDATE;TZID=America/New_York:20180921T130000',
  'RRULE:FREQ=WEEKLY;UNTIL=20190208T045959Z;INTERVAL=2;BYDAY=FR' ]

The error is:

error: Unable to generate daily stats. Transaction failed. Error: Unsupported RFC prop EXDATE in EXDATE;TZID=America/New_York:20180921T130000
    at parseLine (/xxx/functions/node_modules/rrule/dist/es5/rrule.js:1004:19)
    at Array.map (<anonymous>)
    at Function.parseString (/xxx/functions/node_modules/rrule/dist/es5/rrule.js:972:41)
    at Function.RRule.fromString (/xxx/functions/node_modules/rrule/dist/es5/rrule.js:2006:32)
    at RecurrenceWorker.getRRule (/xxx/functions/lib/src/algorithm/workers/recurrenceWorker.js:81:40)
    at RecurrenceWorker.between (/xxx/functions/lib/src/algorithm/workers/recurrenceWorker.js:20:29)
    at RecurrenceWorker.getStartEndArrayFromRecurrence (/xxx/functions/lib/src/algorithm/workers/recurrenceWorker.js:52:29)
    at AvailableTimeForTasksWorker.calculateMinutesTakenByRecurringEvent (/xxx/functions/lib/src/stats/workers/availableTimeForTasksWorker.js:170:60)
    at AvailableTimeForTasksWorker.<anonymous> (/xxx/functions/lib/src/stats/workers/availableTimeForTasksWorker.js:67:43)
    at Generator.next (<anonymous>)
  • The version of rrule you are using: 2.6.0
  • Your operating system: no idea, the code is executed by Google Firebase

Isn't EXDATE string valid? It comes from Google Calendar

@davidgoli
Copy link
Collaborator

davidgoli commented May 12, 2019

It's not valid in the RFC for EXDATE to have a different TZID from DTSTART. However, it should still parse. The problem is fromString only deals with RRule (and not RRuleSet); the RRule class doesn't support the EXDATE prop; you need to use rrulestr in order to support RRuleSet props like EXDATE.

You should use this with rrulestr as follows:

rrulestr([
  'DTSTART:20180323T170000Z',
  'EXDATE;TZID=America/New_York:20180921T130000',
  'RRULE:FREQ=WEEKLY;UNTIL=20190208T045959Z;INTERVAL=2;BYDAY=FR'
].join('\n'))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants