Skip to content

One time scheduled events don't have a next occurrence#103

Open
faburem wants to merge 1 commit into
bunkat:masterfrom
faburem:master
Open

One time scheduled events don't have a next occurrence#103
faburem wants to merge 1 commit into
bunkat:masterfrom
faburem:master

Conversation

@faburem

@faburem faburem commented Jun 23, 2015

Copy link
Copy Markdown

check if the next[0] occurrence is defined before processing it further

@fcarreiro

Copy link
Copy Markdown

Hi @bunkat , this lib is great work!
However ( :) ) I'm running into trouble when using one-off times, I think it may be related to this fix.

const later = require('later')
const sc = later.parse.recur()
  .on(new Date('2017-06-15T15:00:00Z')).fullDate().and()
  .on(new Date('2017-06-16T15:00:00Z')).fullDate()
console.log(later.schedule(sc).next(10))

yields

/home/app/backend/node_modules/later/later.js:777
        return !b || a.getTime() > b.getTime();
                       ^

TypeError: a.getTime is not a function
    at /home/app/backend/node_modules/later/later.js:777:24
    at findNext (/home/app/backend/node_modules/later/later.js:785:23)
    at getInstances (/home/app/backend/node_modules/later/later.js:637:52)
    at Object.next (/home/app/backend/node_modules/later/later.js:796:16)

Comments? @faburem

@faburem

faburem commented Jun 14, 2017

Copy link
Copy Markdown
Author

That is exactly the issue I was running into. Unfortunately my pull request still hasn't been merged. I'm using my fork in production for quite a while now and didn't encounter any problems yet.

@niftylettuce

Copy link
Copy Markdown

Per my work with Bree, I have an updated fork of this package called @breejs/later. See https://github.com/breejs/later if you would like to file this PR there.

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

Successfully merging this pull request may close these issues.

3 participants