I am trying to get Current rangeSlider value (which is time) but it gives a huge number i-e to and from values are respectivly :[1650478833060, 1650394800000]. Its not a unixTime formate i tried that; so can any one help me get rangeSlider Exect value. thankyou
my code HTML
<input type="text" id="ion" name="example_name" value="" /></td>
<button type="button" onclick="getRangeValue();"class="btn btn-secondary" style="width: 98%; ">Blanking</button>
Javascript code
$('#ion').ionRangeSlider({
grid: true,
type: 'double',
min: moment("000000", "hhmmss").valueOf(),
max: moment("235959", "hhmmss").valueOf(),
force_edges: true,
drag_interval: true,
step: 60,
min_interval: 60,
prettify: function(num) {
return moment(num).format('HH:mm:ss');
}
});
function getRangeValue() {
var slider = $("#ion").data("ionRangeSlider");
// Get values
var from = slider.result.from;
var to = slider.result.to;
console.log("values ", [to , from]);
}
my Output are [1650478833060, 1650394800000] i have tried serval ways like
let seconds = Math.floor(milliseconds / 1000);
let minutes = Math.floor(seconds / 60);
let hours = Math.floor(minutes / 60);
seconds = seconds % 60;
minutes = minutes % 60;
// ️ If you don't want to roll hours over, e.g. 24 to 00
// ️ comment (or remove) the line below
// commenting next line gets you `24:00:00` instead of `00:00:00`
// or `36:15:31` instead of `12:15:31`, etc.
hours = hours % 24;
return `${padTo2Digits(hours)}:${padTo2Digits(minutes)}:${padTo2Digits(
seconds,
)}`;
In this function
i consoled
slider.result
value and it had an prettify time value in it which is the excet time on slider. so final code was.