Disable Minutes Selection In Bootstrap Datetimepicker
I wan't datetimepicker to show only rounded hours and disable minutes selection. So user will be able to pick only hours, like 02:00. However I can't achieve this simple task. Here
Solution 1:
Here is one example for you, i think it will help you.
jsfiddle.net/tmk0293z/7/
There is changedate event bind with a function and changes the another startdate of other field.
Thanks, Nishit Zinzuvadiya
Here is the actual code (HTML):
<div class="input-append date form_datetime" id="first">
<inputtype="text"value=""readonly><spanclass="add-on"><iclass="icon-th"></i></span></div><divclass="input-append date form_datetime"id="second"><inputtype="text"value=""readonly><spanclass="add-on"><iclass="icon-th"></i></span></div><spanid="selected"></span>
JS:
$(".form_datetime").datetimepicker({
format:"dd MM yyyy - hh:ii",
minView:1,
autoclose:true
});
$("#first").datetimepicker().on("changeDate", function(e){
var first = new Date(e.date.setMinutes(0));
first.setHours(first.getHours()+first.getTimezoneOffset()/60); //timezone correction
$("#second").datetimepicker('setStartDate', first);
//other = $("#first").find("input").val();
//$("#second").datetimepicker('setStartDate', other); //works also
});
Solution 2:
see the option viewMode and format https://eonasdan.github.io/bootstrap-datetimepicker/Options/
Solution 3:
try using step: 60 not steps please check this link also :click here
Post a Comment for "Disable Minutes Selection In Bootstrap Datetimepicker"