mattpat/node-schedule — Issue #5: Return handle for job is null when scheduling a "Date" based Job
Author: nbose
Created: 2012-02-16 18:24:05+00:00
State: open

Hello,

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.');
});
console.log(j);
```

-- 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);
scheduleInvocation(inv);
success = this.trackInvocation(inv);
}
....
```
compared to the existing code which is

```
success = scheduleInvocation(inv);
if (success)
this.trackInvocation(inv);
```

Thanks,
Nithin