later
later copied to clipboard
Bug getting next() occurrences with composite schedule where each clause has a year
It seems one can't use and()
if every clause has a year()
. The schedule can be created correctly (I see an array like [{M: [2], Y: [2017]}, {M: [4], Y: [2018]}]
in the schedules
field), but calling next()
errors. So it appears the issue is in getting occurrences for composite schedules, not in the parser.
e.g. it errors on later.schedule(sched).next(2)
when sched is
.on(2).month().on(2017).year()
.and()
.on(3).month().on(2018).year()
.and()
.on(4).month().on(2019).year()
but not when sched is
.on(2).month()
.and()
.on(3).month().on(2018).year()
.and()
.on(4).month().on(2019).year()
Note that the second one's first clause is .on(2).month()
, WITHOUT .on(2017).year()
.
As another clue, re-ordering the clauses (for example having the clause without .year()
be the third clause instead of first) changes the behavior, in that case causing it to error.
Been liking the package! But this does appear to be a bug.