添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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

Hi, i've spent hours trying to figure out what am I doing wrong, but it looks like there's an issue with the library itself.

Bellow you can see my code snippet.
A few things to have in mind:

  • i tried to generate RRuleSet manually (same thing):
  • set.exdate(new Date(Date.UTC(2019, 5, 20, 0, 0)));
  • when i drop RRULE and instead use multiple RDATE, then EXDATE works!
  • My snippet:

    const str = 'RRULE:FREQ=DAILY;UNTIL=20200630T000000\nEXDATE:20190619T000000'
    const set: RRuleSet = rrulestr(str) as RRuleSet;
    const rdates = set.all();
    console.log(rdates);

    Expected output:

    Every single day except 2019-06-19

    Actual output:

    Every single day, with no exclusion...

    Version of rrule:

    2.6.0

    Operatin system:

    Mac OS

    Local Timezone:

    Im having issues with trying to pass EXDATE in a rule.
    I just get Error: Unknown RRULE property 'EXDATE'
    This also happens on the demo when using the string input

    @DeanOutlaw This is because EXDATE is not an RRULE property. It is a top-level property (alongside, not nested under, RRULE). For example:

    DTSTART:20190101T120000Z
    RRULE:FREQ=WEEKLY
    EXDATE:20190108T120000Z
    

    @DeanOutlaw This is because EXDATE is not an RRULE property. It is a top-level property (alongside, not nested under, RRULE). For example:

    DTSTART:20190101T120000Z
    RRULE:FREQ=WEEKLY
    EXDATE:20190108T120000Z
    

    How do I add an exdate then? dtstart is an rrule property on the rrule object. I do not want to use an rrule set - I should be able to do this just with toString() and fromString()

    @stclairdaniel rrulejs is largely based on the iCal spec. dtstart is an rrule property out of necessity. Many rrules can only be interpreted in the context of their dtstart.

    For example,

    DTSTART:20190101T120000Z
    RRULE:FREQ=WEEKLY
    

    What day of the week are occurrences on? The dtstart tells you.

    In contrast, EXDATE does not affect the RRULE, it affects the VEVENT object. Technically, a VEVENT can have multiple RRULEs associated with it. The occurrences associated with the VEVENT are the distinct union of all the occurrences produced by its RRULEs, minus the occurrences produced by the EXRULEs, plus the RDATEs, minus the EXDATEs. In rrulejs, RRuleSet approximates the VEVENT recurrence logic.

    I should be able to do this just with toString() and fromString()

    Try the rrulestr function on your ical fragment. You should get back an RRuleSet object.

    const str = `DTSTART:20190101T120000Z
    RRULE:FREQ=WEEKLY
    EXDATE:20190108T120000Z`;
    const rruleset = rrulestr(str);
    

    I do not want to use an rrule set

    ¯_(ツ)_/¯

    freq: RRule.WEEKLY, byweekday: [RRule.MO, RRule.FR], dtstart: new Date(2021, 1, 1, 10, 30), until: new Date(2021, 2, 2, 14, 30), const tempExRule = new RRule({ freq: RRule.WEEKLY, byweekday: [RRule.MO], dtstart: new Date(2021, 1, 8, 10, 30), until: new Date(2021, 1, 26, 14, 30), const rule = new RRule(tempRule); const ruleSet = new RRuleSet(); ruleSet.rrule(rule); const exRule = new RRule(tempExRule); const exRuleSet = new RRuleSet(); exRuleSet.rrule(tempExRule); let arr1 = ruleSet.all().map((x) => JSON.stringify(x)); let arr2 = exRuleSet.all().map((x) => JSON.stringify(x)) let difference = arr1.filter((x) => !arr2.includes(x)); difference = difference.map((x) => new Date(x.slice(1, -1))); console.log(difference)

    I'm not sure if this is related but we seem to be having problems with exdate on OSX specifically. On windows and our linux environment there are no problems but on OSX we get rules.exdate is not a function

    I am still getting this same error. In the js code I can see there is reference to exdate but when I use it in the tule string I receive the error listed above.