Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting values via the min, max, or values methods on dateRangeSlider produces an invalid slider #146

Closed
lightswitch05 opened this issue Nov 17, 2013 · 14 comments
Labels

Comments

@lightswitch05
Copy link

DEMO - Setting values via the values, min, or max methods on dateRangeSlider causes invalid results on the slider.

Expected Results
image

Actual Results
image

Initialization

$("#slider").dateRangeSlider({
    bounds:{
      min: new Date("2013-01-01 00:00:00"),
      max: new Date("2013-12-31 00:00:00")
    },
    defaultValues:{
      min: new Date("2013-01-01 00:00:00"),
      max: new Date("2013-12-31 00:00:00")
    } 
});

Setting Values
After initialization, the slider is in a valid state. Calling any of the below function causes the slider to become invalid:

$("#slider").dateRangeSlider("min", new Date("2013-05-01 00:00:00"));

$("#slider").dateRangeSlider("max", new Date("2013-11-30 00:00:00"));

$("#slider").dateRangeSlider("values",
    new Date("2013-05-01 00:00:00"),
    new Date("2013-11-30 00:00:00")
);
@lightswitch05
Copy link
Author

I created a bounty for this issue at BountySource

@ghusse
Copy link
Owner

ghusse commented Nov 19, 2013

Thanks, that's very kind of you to offer money for fixing this issue.

But actually, according to behavioral economics, your bounty will have a
negative impact on the probability of someone fixing this bug. At least
until the bounty reaches a consequent amount of money.

In short: choose between a larger bounty or no bounty at all if you want
your bug to be fixed.

That's my 2 cent advice :-)

Anyway, I'll take a look.

On Tue, Nov 19, 2013 at 4:03 PM, Daniel notifications@github.com wrote:

I created a bounty for this issue at BountySourcehttps://www.bountysource.com/issues/1328582-setting-values-via-the-min-max-or-values-methods-on-daterangeslider-produces-an-invalid-slider


Reply to this email directly or view it on GitHubhttps://github.com//issues/146#issuecomment-28796603
.

@lightswitch05
Copy link
Author

I've done a little bit of debugging, it has something to do with the setTimeouts. The min, max, and values methods all work fine if enough time is given after initialization before they are called. I think this issue is a duplication of #73 - perhaps it needs to be re-opened.

Thanks for your advice, I see the bounty as a way to say thanks to whoever can fix it, not as motivation to fix it.

@ghusse
Copy link
Owner

ghusse commented Nov 20, 2013

Hello,

I'll take a look.

If you can do this, try to call the method values with the min and max
values you're trying to set.

On Sun, Nov 17, 2013 at 11:22 PM, Daniel notifications@github.com wrote:

Calling the min and max methods on dateRangeSlider causes invalid results
on the slider - demo http://jsfiddle.net/Cn2bE/1/

Expected Results
[image: image]https://f.cloud.github.com/assets/598803/1559512/dd378d8a-4fd5-11e3-87b8-f9f1e2fbb881.png

Actual Results
[image: image]https://f.cloud.github.com/assets/598803/1559521/221bf9b8-4fd6-11e3-83c2-652671da76d8.png

Code

$("#slider").dateRangeSlider({
bounds:{
  min: new Date(2008, 04, 09),
  max: new Date(2013, 11, 18)
},
defaultValues:{
  min: new Date(2008, 04, 10),
  max: new Date(2013, 11, 17)
}

});

$("#slider").dateRangeSlider("min", new Date(2008, 04, 11));
$("#slider").dateRangeSlider("max", new Date(2013, 11, 16));


Reply to this email directly or view it on GitHubhttps://github.com//issues/146
.

@lightswitch05
Copy link
Author

wrapping the values call in a setTimeout has fixed the problem, although I wouldn't really call it a solution. Fixed demo: http://jsfiddle.net/Cn2bE/6/

ghusse added a commit that referenced this issue Feb 1, 2014
…RangeSlider produces an invalid slider
@ghusse
Copy link
Owner

ghusse commented Feb 1, 2014

Fixed in 5.6.0

@ghost
Copy link

ghost commented Feb 12, 2014

I'm using 5.6.0 with jqueryui 1.10.3 and jquery 1.10.2 and it seems the problem is still persistent. The #144 too

@ghost
Copy link

ghost commented Feb 28, 2014

Anyone got this again?

@ghusse
Copy link
Owner

ghusse commented Feb 28, 2014

Can you create a jsfiddle showing the problem?

@ghost
Copy link

ghost commented Feb 28, 2014

I tried here:
http://jsfiddle.net/2hdCe/1/
I was not able to add the jqdaterangeslider-min.js and the css as resources, so please add them before testing :)

@ghusse
Copy link
Owner

ghusse commented Feb 28, 2014

Reproduced here:

http://jsfiddle.net/HxZG3/

Damn

@ghusse ghusse reopened this Feb 28, 2014
@ghost
Copy link

ghost commented Feb 28, 2014

Exactly...

@ghusse
Copy link
Owner

ghusse commented Mar 18, 2014

Fixed in 5.7

@ghusse ghusse closed this as completed Mar 18, 2014
@ghost
Copy link

ghost commented Mar 19, 2014

Great! Fixed for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants