diff --git a/lib/timeline/TimeStep.js b/lib/timeline/TimeStep.js index 52715220..0639b35d 100644 --- a/lib/timeline/TimeStep.js +++ b/lib/timeline/TimeStep.js @@ -28,7 +28,7 @@ var util = require('../util'); * @param {Date} [end] The end date * @param {Number} [minimumStep] Optional. Minimum step size in milliseconds */ -function TimeStep(start, end, minimumStep, hiddenDates) { +function TimeStep(start, end, minimumStep, hiddenDates, options) { this.moment = moment; // variables @@ -58,6 +58,8 @@ function TimeStep(start, end, minimumStep, hiddenDates) { } this.format = TimeStep.FORMAT; // default formatting + this.options = options ? options : {}; + } // Time formatting @@ -222,6 +224,8 @@ TimeStep.prototype.next = function() { if (this.current.weekday() !== 0){ // we had a month break not correlating with a week's start before this.current.weekday(0); // switch back to week cycles this.current.add(this.step, 'week'); + } else if(this.options.showMajorLabels === false) { + this.current.add(this.step, 'week'); // the default case } else { // first day of the week var nextWeek = this.current.clone(); nextWeek.add(1, 'week'); diff --git a/lib/timeline/component/TimeAxis.js b/lib/timeline/component/TimeAxis.js index 3b0d6103..0ef9f515 100644 --- a/lib/timeline/component/TimeAxis.js +++ b/lib/timeline/component/TimeAxis.js @@ -201,7 +201,7 @@ TimeAxis.prototype._repaintLabels = function () { var minimumStep = timeLabelsize - DateUtil.getHiddenDurationBefore(this.options.moment, this.body.hiddenDates, this.body.range, timeLabelsize); minimumStep -= this.body.util.toTime(0).valueOf(); - var step = new TimeStep(new Date(start), new Date(end), minimumStep, this.body.hiddenDates); + var step = new TimeStep(new Date(start), new Date(end), minimumStep, this.body.hiddenDates, this.options); step.setMoment(this.options.moment); if (this.options.format) { step.setFormat(this.options.format);