From 3bc182b26aa7774e1cdcfece90b53dc2995eda91 Mon Sep 17 00:00:00 2001 From: Uli Fahrer Date: Fri, 16 Dec 2016 23:33:23 +0100 Subject: [PATCH] Fix Range ctor with optional options parameter (#2468) --- lib/timeline/Range.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/timeline/Range.js b/lib/timeline/Range.js index 577e0863..e49951d4 100644 --- a/lib/timeline/Range.js +++ b/lib/timeline/Range.js @@ -14,8 +14,17 @@ var DateUtil = require('./DateUtil'); */ function Range(body, options) { 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.body = body;