How can I set default time instead of current time for this datetimepicker http://tarruda.github.io/bootstrap-datetimepicker/ ?
How to set default time on Bootstrap timepicker
Asked Answered
You can set the default time via JavaScript :
$('mySelector').timepicker({defaultTime: '10:45 PM'});
Or directly via the value attribute of your timepicker :
<div class="bootstrap-timepicker">
<input id="timepicker" type="text" value="10:45 AM"/>
</div>
$('.myClass').timepicker({defaultTime: 'value'});
EDIT : was for the default timepicker of boostrap, my bad.
For your specific timepicker, it seems possible to set the datetime like this :
var picker = $('#datetimepicker').data('datetimepicker');
picker.setDate(myDate);
From the documentation page..
setTime Set the time manually
$('#timepicker').timepicker('setTime', '12:45 AM');
For bootstrap timepicker this would work :
$('selector').val("time");
I Think You Should try this. It work for me
$('.time').timepicker({
minuteStep: 1,
defaultTime: null
});
Set value before to initialize timepicker
$('#start_time').val('12:00 AM');
$('#start_time').timepicker();
Might be working this way
© 2022 - 2024 — McMap. All rights reserved.