bootstrap-timepicker
bootstrap-timepicker copied to clipboard
can't set defaultTime when showMeridian is false
when I try to use setTime by handing it a value like "15:00" while showMeridian is false, it doesn't work. I just get 12:00AM (12 hour time) as my default value when the timepicker is initialized.
I have similar problem - I also set "showMeridian = false", "defaultTime: 'current' " and after initialization control has values "0:00" instead of current time. Can anybody provide solution for this problem please?
Or suggest fork of this project which is updated for bootstrap v3.3.x and bulletproof for this kind of problems?
1.you can include bootstrap-timepicker.js file not min.js file 2.set you input(defaultTime="12:00")
I already was using .js file because i needed to change fontawesome class "icon-chevron-up" to "fa fa-chevron-up" to see icons above/below number text fields.
Unfortunately, setting date for me didn't work via "defaultTime" in any way. So I create workaround:
$("#myTimepicker").timepicker({
showMeridian: false,
minuteStep: 1
});
var dt = new Date();
var time = dt.getHours() + ":" + dt.getMinutes()
$('#myTimepicker').timepicker('setTime', time);
It's shame that this simple and useful plugin (first result in google) isn't refreshed for such a long period or at least forked, fixed and upgraded to work with new bootstrap/jquery without this small problems.
@slavenl What's stopping you?
Too much work, at work, in this point of time. Also, my knowledge of JS / jQuery isn't at adequate level for such work, for now. I' m back-end developer primarily.
But it would be nice if you can do some upgrade. This is your child, almost perfect child. Make it perfect! :)
Any updates on it?
@dmitriy-sqrt are you still having this problem? I've just tried the following code and it worked flawlessly:
<div class="input-group bootstrap-timepicker timepicker">
<input id="timepicker1" type="text" class="form-control input-small">
<span class="input-group-addon"><i class="glyphicon glyphicon-time"></i></span>
</div>
<script type="text/javascript">
$('#timepicker1').timepicker({
"showMeridian":false,
"defaultTime":'15:00',
});
</script>
If the problem persists, can you paste a snipped of your code, please?
@mooreniemi @slavenl @dmitriy-sqrt Can we close this?