Dana Dana - 2 months ago 12
jQuery Question

JQDateRangeSlider change start/end value

I've been working with DateRangeSlider for a couple of days and now I'm using it as a time slider - fiddle

My problem is that the min time is 02:00 and it needs to be 00:00, and max time is 01:59 instead of 23:59.

If I changed the formatter values from

h = val.getHours(),
m = val.getMinutes();


to

h = val.getUTCHours(),
m = val.getUTCMinutes();


it displays the correct start-end hour but when I'm getting those values:

var values = $("#slider").dateRangeSlider('values');
var test = values.min;


it still gets the other values: 02:00 instead of 00:00.

Is there any way to format the min/max value but when the values are read to display the same hour?

Answer

I have updated format for date and time as below

var min2 = new Date(2014, 0, 1, 00, 00, 00),
    max2 = new Date(2014, 11, 31, 23, 59, 59);

Please check http://jsfiddle.net/LJrYf/149/ fiddle now.

I have updated your code and now its working as expected.

Comments