Open sonylouis opened 8 years ago
i used this script : `var min2 = new Date("2014-01-01 00:00:00"), max2 = new Date("2014-01-02 00:00:00");
function addZero(val) { if (val < 10) { return "0" + val; } return val; } $("#slider2").dateRangeSlider({ bounds: { "min": min2, "max": max2 }, range: { min: { minutes: 1 } }, scales: [ //primary { first: function(val) { return val; }, next: function(val) { var next = new Date(val); return new Date(next.setMinutes(val.getMinutes() + 30)); }, stop: function(val) { return false; }, label: function(val) { return addZero(val.getHours()) + ':' + addZero(val.getMinutes()); }, format: function(tickContainer, tickStart, tickEnd) { tickContainer.addClass("myCustomClass"); } }, //secondary { first: function(val) { return val; }, next: function(val) { var next = new Date(val); return new Date(next.setMinutes(val.getMinutes() + 1)); }, stop: function(val) { return false; }, label: function(val) { return ""; }, format: function(tickContainer, tickStart, tickEnd) { } } ], formatter: function(val) { var h = val.getHours(), m = val.getMinutes(); return addZero(h) + ':' + addZero(m); }, defaultValues: { min: new Date("2014-01-01 00:00:00"), max: new Date("2014-01-01 00:00:50") } });`
but how if i want to add seconds label ? thx
Hello,
Just change the formatter function to display seconds. You get a Date object, on which you can call getSeconds() to get the number of seconds
getSeconds()
i used this script : `var min2 = new Date("2014-01-01 00:00:00"), max2 = new Date("2014-01-02 00:00:00");
but how if i want to add seconds label ? thx