Skip to content
This repository has been archived by the owner on Aug 27, 2020. It is now read-only.

recur.every('Wednesday').daysOfWeek().fromDate('07/18/2018').next(2, 'L') returns from date in result #32

Open
karn09 opened this issue Jul 18, 2018 · 2 comments

Comments

@karn09
Copy link

karn09 commented Jul 18, 2018

In these examples, I would expect the result to not include '07/18/2018' and instead would return

['07/25/2018', '08/01/2018']
As an example:

const wedRecur = moment.recur().every('Wednesday').daysOfWeek()
const today = moment('07/18/2018')
if (wedRecur.matches(today)) {
    wedRecur.fromDate(today).next(2, 'L')
}

const wedRecur = moment.recur().every(3).daysOfWeek()
const today = moment('07/18/2018')
if (wedRecur.matches(today)) {
    wedRecur.fromDate(today).next(2, 'L') // ['07/18/2018', '07/25/2018']
}
@jefbarn
Copy link
Owner

jefbarn commented Jul 18, 2018

The 'from' date is included in the result, this is just matching the moment-recur api.

@karn09
Copy link
Author

karn09 commented Jul 19, 2018

I see. After running some examples, I found that using .fromDate() forces the results of .next() to include the param passed to fromDate, whereas using startDate() the results of next will not include the param.

Definitely useful.

Thanks

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

No branches or pull requests

2 participants