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

RRule DAILY+ WEEKDAYS - failure on the weekends #291

Open
adilsolva opened this issue Oct 16, 2018 · 2 comments
Open

RRule DAILY+ WEEKDAYS - failure on the weekends #291

adilsolva opened this issue Oct 16, 2018 · 2 comments
Labels

Comments

@adilsolva
Copy link

Scenario:

  • every 20 weekdays create a new recurrence for 3 times.
  • start date: 2018-11-06

Expected Result:

  • Tue 2018-11-06
  • Mon 2018-11-26
  • Mon 2018-12-17 <--

Rule:
new RRule({ freq: RRule.DAILY, dtstart: new Date(Date.UTC(2018, 10, 6, 18, 18, 0)), tzid: America/Campo_Grande, count: 3, interval: 20, byweekday: [RRule.MO, RRule.TU, RRule.WE, RRule.TH, RRule.FR] })

Result:

  • Tue 2018-11-06
  • Mon 2018-11-26
  • Fri 2019-01-25 <--

When no weekdays

  • Tue 2018-11-06
  • Mon 2018-11-26
  • Sun 2018-12-16 <--

It looks like the plugin is restarting the counter when the day falls on the weekend and recalculates the entire interval until find the day that falls on the weekday
Would be that correct behavior?

@davidgoli davidgoli added the bug label Oct 20, 2018
@davidgoli
Copy link
Collaborator

Yes, this looks like a legitimate bug. I can reproduce with the following minimal test case:

  it('#291', () => {
    const rule = new RRule({
      freq: RRule.DAILY,
      dtstart: new Date(Date.UTC(2018, 10, 6)),
      count: 3,
      interval: 20,
      byweekday: [
        RRule.MO, RRule.TU, RRule.WE, RRule.TH, RRule.FR
      ]
    })

    expect(rule.all()).to.deep.equal([
      new Date(Date.UTC(2018, 10, 6)),
      new Date(Date.UTC(2018, 10, 26)),
      new Date(Date.UTC(2018, 12, 17)),
    ])
  })

I don't have the immediate bandwidth to fix this soon, but would love to review a pull request fixing it

@egeersoz
Copy link

Any updates on this issue?

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

No branches or pull requests

3 participants