Hello. I have problem with slider in jquery. I need prepare slider for date an time but i don't know how it make. Below my code. Someone have idea how change my slider for date and time on format (YYYY-MM-DD h:mm) .
var minVal, maxVal, infoMin, infoMax, data1, data2;
data1 = '2016-02-10 10:36'
data2 = '2016-02-11 13:47'
minVal = '10:36';
maxVal = '13:47';
minVal = parseInt(minVal.substring(0, 2) * 60) + parseInt(minVal.substring(3, 5))
maxVal = parseInt(maxVal.substring(0, 2) * 60) + parseInt(maxVal.substring(3, 5))
jQuery(function () {
jQuery('#slider-time').slider({
range: true,
min: parseInt(minVal),
max: parseInt(maxVal),
step: 1,
values: [minVal,maxVal],
slide: function (event, ui) {
var hours1 = Math.floor((ui.values[0]) / 60) ;
var minutes1 = (ui.values[0] - (hours1 * 60));
if (hours1 == 0)
{ hours1 = '0' + hours1; }
else if (hours1<10)
{hours1= '0' + hours1;}
if (minutes1 == 0)
{ minutes1 = '00'; }
else if (minutes1 < 10)
{ minutes1 = '0' + minutes1;}
var hours2 = Math.floor(ui.values[1] / 60) ;
var minutes2 = ui.values[1] - (hours2 * 60);
if (hours2 == 0)
{ hours2 = '0' + hours2; }
else if (hours2 < 10)
{ hours2 = '0' + hours2; }
if (minutes2 == 0)
{ minutes2 = '00'; }
else if (minutes2 < 10)
{ minutes2 = '0' + minutes2; }
if (minutes2 == 0)
minutes2 = '00';
$('#tb3').val(hours1 + ':' + minutes1+':00')
$('#tb4').val(hours2 + ':' + minutes2 + ':00')
}
});
});
<div id="slider-time"></div>
<asp:TextBox ID="tb3" runat="server"></asp:TextBox>
<asp:TextBox ID="tb4" runat="server"></asp:TextBox>
What I have tried:
Added before an hour date but i can't change date and time together.