Browse Source

Fix Range ctor with optional options parameter (#2468)

readme-improvements
Uli Fahrer 8 years ago
committed by yotamberk
parent
commit
3bc182b26a
1 changed files with 11 additions and 2 deletions
  1. +11
    -2
      lib/timeline/Range.js

+ 11
- 2
lib/timeline/Range.js View File

@ -14,8 +14,17 @@ var DateUtil = require('./DateUtil');
*/ */
function Range(body, options) { function Range(body, options) {
var now = moment().hours(0).minutes(0).seconds(0).milliseconds(0); var now = moment().hours(0).minutes(0).seconds(0).milliseconds(0);
this.start = options.start || now.clone().add(-3, 'days').valueOf();
this.end = options.end || now.clone().add(4, 'days').valueOf();
var start = now.clone().add(-3, 'days').valueOf();
var end = now.clone().add(-3, 'days').valueOf();
if(options === undefined) {
this.start = start;
this.end = end;
} else {
this.start = options.start || start
this.end = options.end || end
}
this.rolling = false; this.rolling = false;
this.body = body; this.body = body;

Loading…
Cancel
Save