简体   繁体   中英

Minute in bootstrap datetimepicker not working

I am using bootstrap-datetimepicker-0.0.11 on my input type text element.

Date picking works fine but minute functionality is not working.

When incrementing minute arrow, nothing happens, and on decrementing hour values gets decremented instead of minute value.

Here's my html snippet:

<div class="form-group col-md-6">
     <label for="date_from">Date From *</label>
     <input type="text" readonly name="date_from" class="form-control date_from" id="date_from" placeholder="Enter training start date">
</div>
<div class="form-group col-md-6">
     <label for="date_to">Date To *</label>
     <input type="text" readonly name="date_to" class="form-control date_to" id="date_to" placeholder="Enter training end date">
</div>

And here's datetimepicker initialization:

$('.date_from, .date_to').datetimepicker({format: 'YYYY-MM-DD HH:MM'});

Anyone happens to know why the plugin is working in unexpected manner?

Try this:

<div class='input-group date' id='datetimepicker1'>
</div>
<script type="text/javascript">
    $(function () {
        $('#datetimepicker1').datetimepicker();
    });
</script>

Try this datetime format:

$('.date_from, .date_to').datetimepicker({format: 'YYYY-MM-DD HH:ii'});

where 'M' and 'm' are the same so you were probably confused by using the month value instead of the minute value. The minute value is declared by 'i'

See more information here: https://www.malot.fr/bootstrap-datetimepicker/demo.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM