Browse Source

Merge pull request #1822 from herregroen/master

reset switched{Day,Month,Year} in next function, not in isMajor function
codeClimate
Alex 8 years ago
parent
commit
94d9fdc5c9
1 changed files with 6 additions and 4 deletions
  1. +6
    -4
      lib/timeline/TimeStep.js

+ 6
- 4
lib/timeline/TimeStep.js View File

@ -245,6 +245,11 @@ TimeStep.prototype.next = function() {
this.current = this._end.clone();
}
// Reset switches for year, month and day. Will get set to true where appropriate in DateUtil.stepOverHiddenDates
this.switchedDay = false;
this.switchedMonth = false;
this.switchedYear = false;
DateUtil.stepOverHiddenDates(this.moment, this, prev);
};
@ -443,7 +448,7 @@ TimeStep.snap = function(date, scale, step) {
var _step = step > 5 ? step / 2 : 1;
clone.milliseconds(Math.round(clone.milliseconds() / _step) * _step);
}
return clone;
};
@ -454,7 +459,6 @@ TimeStep.snap = function(date, scale, step) {
*/
TimeStep.prototype.isMajor = function() {
if (this.switchedYear == true) {
this.switchedYear = false;
switch (this.scale) {
case 'year':
case 'month':
@ -470,7 +474,6 @@ TimeStep.prototype.isMajor = function() {
}
}
else if (this.switchedMonth == true) {
this.switchedMonth = false;
switch (this.scale) {
case 'weekday':
case 'day':
@ -484,7 +487,6 @@ TimeStep.prototype.isMajor = function() {
}
}
else if (this.switchedDay == true) {
this.switchedDay = false;
switch (this.scale) {
case 'millisecond':
case 'second':

Loading…
Cancel
Save