diff --git a/README.md b/README.md index e6178e61..64d3d2bc 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ Parameter Based - `timeZone` - [OPTIONAL] - Specify the timezone for the execution. This will modify the actual time relative to your timezone. If the timezone is invalid, an error is thrown. You can check all timezones available at [Moment Timezone Website](http://momentjs.com/timezone/). Probably don't use both `timeZone` and `utcOffset` together or weird things may happen. - `context` - [OPTIONAL] - The context within which to execute the onTick method. This defaults to the cronjob itself allowing you to call `this.stop()`. However, if you change this you'll have access to the functions and values within your context object. - `runOnInit` - [OPTIONAL] - This will immediately fire your `onTick` function as soon as the requisite initialization has happened. This option is set to `false` by default for backwards compatibility. - - `utcOffset` - [OPTIONAL] - This allows you to specify the offset of your timezone rather than using the `timeZone` param. Probably don't use both `timeZone` and `utcOffset` together or weird things may happen. + - `utcOffset` - [OPTIONAL] - This allows you to specify the offset of your timezone rather than using the `timeZone` param. This should be an integer amount representing the number of minutes offset (like `120` for +2 hours or `-90` for -1.5 hours) Probably don't use both `timeZone` and `utcOffset` together or weird things may happen. - `unrefTimeout` - [OPTIONAL] - If you have code that keeps the event loop running and want to stop the node process when that finishes regardless of the state of your cronjob, you can do so making use of this parameter. This is off by default and cron will run as if it needs to control the event loop. For more information take a look at [timers#timers_timeout_unref](https://nodejs.org/api/timers.html#timers_timeout_unref) from the NodeJS docs. - `start` - Runs your job. - `stop` - Stops your job. diff --git a/examples/utc_offset_syntax.js b/examples/utc_offset_syntax.js new file mode 100644 index 00000000..0408f193 --- /dev/null +++ b/examples/utc_offset_syntax.js @@ -0,0 +1,16 @@ +const CronJob = require('../lib/cron.js').CronJob; + +console.log('first'); +const job = new CronJob( + '0 0 9 4 * *', + function() { + console.log('message'); + }, + null, + true, + null, + null, + null, + -360, // UTC-6, represented in minutes +); +console.log('second');