vue-slider-component: [Vue-slider warn]: Prop[interval] is illegal, Please make sure that the interval can be divisible

Thanks for this amazing component!

I have a warning in console: [Vue-slider warn]: Prop[interval] is illegal, Please make sure that the interval can be divisible

My parameters are: ‘min’: 0, ‘max’: 4, ‘interval’: 0.1

What am I doing wrong? Thanks for your help!

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 20 (11 by maintainers)

Most upvoted comments

@devorld Thank you, the version has been updated.

Now you can solve this, just like:

min: 0,
max: 40,
interval: 1,
formatter: (val) => val/10,

Thanks, that you are so responsive!

I have tested with the same values and continue getting error message, but I think I understood the idea of this check.

We are checking if our range (this.max - this.min) divides by step (this.inteval) without remainder, am I right?

Like when we have min = 0, max = 10 and step between internal points interval = (max-min) / 10.

I thought that there will be problem with achieving max value, but I’ve tested, and component greatly work with that case.

image

To summarize:

  • this error message is just to make developer know, that all points on slider doesn’t have absolutely same interval between them, am I right?
  • no other problems we are getting in such situation with impossibility to divide range by step without remainder? except little inaccuracy in interval between points

P.S.: Can you add some flag or condition, to switch off this notification in production mode? For example

} else if ((Math.floor((this.maximum - this.minimum) * this.multiple) % (this.interval * this.multiple) !== 0) &&
    (process && process.env && process.env.NODE_ENV !== 'production')) {
    console.error('[VueSlider error]: Prop[interval] is illegal, Please make sure that the interval can be divisible')
}

There is such a problem, in the case of the interval is a decimal, there will be such a problem 4 % 0.1 = 0.09999999999999978.

I will fix the bug as soon as possible and post a new version.

Thank you for the issue