Skip to content

Commit

Permalink
src: accept UTC dates in milliseconds
Browse files Browse the repository at this point in the history
- Add a new test.
  • Loading branch information
santigimeno committed Aug 25, 2015
1 parent 79b9cbd commit 0da6d66
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/schedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Job.prototype.schedule = function(spec) {

} catch (err) {
var type = typeof spec;
if (type === 'string') {
if ((type === 'string') || (type === 'number')) {
spec = new Date(spec);
}

Expand Down
15 changes: 15 additions & 0 deletions test/date-convenience-methods-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ module.exports = {
clock.tick(1250);
}
},
"UTC": {
"Should accept a valid UTC date in milliseconds": function(test) {
test.expect(1);

schedule.scheduleJob(new Date(Date.now() + 1000).getTime(), function() {
test.ok(true);
});

setTimeout(function() {
test.done();
}, 1250);

clock.tick(1250);
}
},
tearDown: function(cb) {
clock.restore();
cb();
Expand Down

0 comments on commit 0da6d66

Please sign in to comment.