Socket
Socket
Sign inDemoInstall

cron

Package Overview
Dependencies
1
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.8 to 1.0.9

3

lib/cron.js

@@ -99,4 +99,5 @@ var exports,

var date = this.realDate ? this.source : moment();
// Set the timezone if given (http://momentjs.com/timezone/docs/#/using-timezones/parsing-in-zone/)
if (this.zone)
date = date.utcOffset(this.zone);
date = date.tz(this.zone);

@@ -103,0 +104,0 @@ if (this.realDate)

{
"name": "cron",
"description": "Cron jobs for your node",
"version": "1.0.8",
"version": "1.0.9",
"author": "Nick Campbell <nicholas.j.campbell@gmail.com> (http://github.com/ncb000gt)",

@@ -6,0 +6,0 @@ "bugs" : {

@@ -239,2 +239,40 @@ var testCase = require('nodeunit').testCase,

},
'test a job with a string and a given time zone': function (assert) {
var clock = sinon.useFakeTimers();
assert.expect(2);
var moment = require("moment-timezone");
var zone = "America/Chicago";
// New Orleans time
var t = moment();
t.tz(zone);
// Current time
d = moment();
// If current time is New Orleans time, switch to Los Angeles..
if (t.hours() === d.hours()) {
zone = "America/Los_Angeles";
t.tz(zone);
}
assert.notEqual(d.hours(), t.hours());
// If t = 59s12m then t.setSeconds(60)
// becones 00s13m so we're fine just doing
// this and no testRun callback.
t.add(1, 's');
// Run a job designed to be executed at a given
// time in `zone`, making sure that it is a different
// hour than local time.
var job = new cron.CronJob(t.seconds() + ' ' + t.minutes() + ' ' + t.hours() + ' * * *', function(){
assert.ok(true);
}, null, true, zone);
clock.tick(1000);
clock.restore();
job.stop();
assert.done();
},
'test a job with a date and a given time zone': function (assert) {

@@ -241,0 +279,0 @@ assert.expect(2);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc