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

Date range bounds with month step don't handle timezone correctly #222

Open
lukaswojnar opened this issue Feb 21, 2017 · 4 comments
Open

Comments

@lukaswojnar
Copy link

lukaswojnar commented Feb 21, 2017

When user is in non-UTC timezone and Month step is enabled, is not possible to set the last day of the month correctly so the slider will end at the end.

These two other issues are about the same problem:

When the date is specified in UTC timezone the slider can correctly be slided to the end of the range. The problem is it adds one month to the slider max bounds as the bound is evaluated with user's timezone.

<div id="range-slider"></div>

<script>
var startBounds = new Date(Date.UTC(2016, 0, 1, 0, 0, 0));
var endBounds = new Date(Date.UTC(2017, 0, 31, 23, 59, 59));

$("#range-slider").dateRangeSlider({
  bounds:{min: startBounds,max: endBounds},
  formatter:function(d){return (d.getMonth()+1)+" - "+d.getFullYear();},range:{min:{months:1}},arrows:false,
  step:{months:1}
}).on("userValuesChanged", function(e, data){
  console.log("min: " + data.values.min + " - " + "max: " + data.values.max);
});
</script>

The same problem has the technical demo example: http://ghusse.github.io/jQRangeSlider/technicalDemo.html (set the operating system timezone to +2 and try the demo)

As you can see in the screenshot, with my timezone settings the last possible date of the slider I can slide to is 2011-06-01 instead of 2011-06-30.

daterangeslider-timezone

@ghusse
Copy link
Owner

ghusse commented Feb 22, 2017

Can you create a fix for this issue?

@lukaswojnar
Copy link
Author

No. I'm sorry, I haven't worked with JS timezones yet.

Can you fix that?

@ghusse
Copy link
Owner

ghusse commented Feb 22, 2017

I don't even reproduce your issue on the demo page

@lukaswojnar
Copy link
Author

I have created a screencast video with the bug: https://vid.me/ZHef

As you can see, when I set max. Bound to: 2011-06-30 the maximum value it allowes me to select is 2011-06-01.

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

No branches or pull requests

2 participants