diff --git a/lib/timeline/TimeStep.js b/lib/timeline/TimeStep.js index 9cb5e07ca..f6d399ea3 100644 --- a/lib/timeline/TimeStep.js +++ b/lib/timeline/TimeStep.js @@ -222,23 +222,7 @@ TimeStep.prototype.next = function() { break; case 'weekday': // intentional fall through case 'day': this.current.add(this.step, 'day'); break; - case 'week': - 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'); - if(nextWeek.isSame(this.current, 'month')){ // is the first day of the next week in the same month? - this.current.add(this.step, 'week'); // the default case - } else { // inject a step at each first day of the month - this.current.add(this.step, 'week'); - this.current.date(1); - } - } - break; + case 'week': this.current.add(this.step, 'week'); break; case 'month': this.current.add(this.step, 'month'); break; case 'year': this.current.add(this.step, 'year'); break; default: break; @@ -548,7 +532,7 @@ TimeStep.prototype.isMajor = function() { case 'day': return (date.date() == 1); case 'week': - return (date.date() == 1); + return (Math.ceil(date.date() / 7) == 1); // is 1st week in the month? case 'month': return (date.month() == 0); case 'year':