bootstrap-timepicker icon indicating copy to clipboard operation
bootstrap-timepicker copied to clipboard

can't set defaultTime when showMeridian is false

Open mooreniemi opened this issue 10 years ago • 8 comments

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.

mooreniemi avatar Jul 08 '14 15:07 mooreniemi

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?

slavenl avatar Nov 26 '14 10:11 slavenl

1.you can include bootstrap-timepicker.js file not min.js file 2.set you input(defaultTime="12:00")

mario-mui avatar Nov 27 '14 07:11 mario-mui

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 avatar Nov 27 '14 08:11 slavenl

@slavenl What's stopping you?

jdewit avatar Nov 27 '14 19:11 jdewit

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! :)

slavenl avatar Nov 28 '14 11:11 slavenl

Any updates on it?

dmitriy-sqrt avatar Sep 10 '15 19:09 dmitriy-sqrt

@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?

mmarchini avatar Sep 10 '15 21:09 mmarchini

@mooreniemi @slavenl @dmitriy-sqrt Can we close this?

mrhota avatar Nov 20 '15 06:11 mrhota