ncb000gt/node-cron — pull request #33 by toots (2012-04-25 05:34:57+00:00)
Title: Fixes for timezone

Hi,

There are a couple of issues with the previous release and making time module optional.

The most important is that it is not a good idea to modify the global `Date` constructor. See for instance:

> d = new Date
Wed, 25 Apr 2012 04:52:27 GMT
> cron = require("cron")
(...)
> new cron.CronJob(d, function () {})
TypeError: Object Tue Apr 24 2012 23:52:27 GMT-0500 (CDT) has no method 'replace'
at Object._parse (/Users/toots/sources/audiosocket/origin/node_modules/cron/lib/cron.js:174:26)
at Object.CronTime (/Users/toots/sources/audiosocket/origin/node_modules/cron/lib/cron.js:26:10)
(...)

The problem here is that `Date` has been modified when requiring the `cron` module, so `d` is not detected with the right `instanceof` and assumed to be a string..

Instead, it is better to define a local `CronDate` constructor and to stick to it internally, making sure that all dates are converted to it..

There were also a couple of minor things with the test that I have changed and commented in the code..