Return handle for job is null when scheduling a "Date" based Job #5

nbose opened this Issue Feb 16, 2012 · 1 comment


None yet

2 participants

nbose commented Feb 16, 2012


The return handle is null when scheduling a job based on a Date object.

var schedule = require('node-schedule');
var d = new Date(2012, 1, 16, 10, 15, 40);

var j = schedule.scheduleJob(d, function(){
    console.log('The world is going to end today.');

-- Output is null

The fix I believe is below

Job.prototype.schedule = function(spec){
    var success = false;
    var job = this;

    if (typeof(spec) == 'object' && spec instanceof Date)
        var inv = new Invocation(this, spec);
        success = this.trackInvocation(inv);

compared to the existing code which is

success = scheduleInvocation(inv);
    if (success)


@mattpat mattpat added a commit that referenced this issue Feb 16, 2012
@mattpat mattpat Fixed issue #5 563b545
mattpat commented Feb 16, 2012

Thanks for the catch, you're absolutely right. Fixed! :)

@mattpat mattpat closed this Feb 16, 2012
@macalinao macalinao added a commit to macalinao/node-schedule that referenced this issue Jan 3, 2015
@macalinao macalinao Fixed issue #5 e1a8206
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment