Skip to content

Commit

Permalink
kue-scheduler next run calculation ignores timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
CristiCimpianu committed Feb 15, 2018
1 parent 4c00073 commit 5416dcc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
13 changes: 1 addition & 12 deletions index.js
Expand Up @@ -517,20 +517,9 @@ Queue.prototype._computeNextRunTime = function (jobData, done) {
//compute next run from cron interval
cron: function (after) {
try {
//last run of the job is now if not exist
var lastRun =
jobData.lastRun ? new Date(jobData.lastRun) : new Date();

//compute next date from the cron interval
var cronTime = new CronTime(interval, timezone);
var nextRun = cronTime._getNextDateFrom(lastRun);

// Handle cronTime giving back the same date
// for the next run time
if (nextRun.valueOf() === lastRun.valueOf()) {
nextRun =
cronTime._getNextDateFrom(new Date(lastRun.valueOf() + 1000));
}
var nextRun = cronTime.sendAt();

//return computed time
after(null, nextRun.toDate());
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -61,7 +61,7 @@
],
"dependencies": {
"async": "^2.5.0",
"cron": "^1.2.1",
"cron": "^1.3.0",
"date.js": "^0.3.1",
"human-interval": "^0.1.6",
"kue": "^0.11.6",
Expand Down

0 comments on commit 5416dcc

Please sign in to comment.