简体   繁体   English

引导日期时间选择器中的分钟不起作用

[英]Minute in bootstrap datetimepicker not working

I am using bootstrap-datetimepicker-0.0.11 on my input type text element. 我在输入类型文本元素上使用bootstrap-datetimepicker-0.0.11

Date picking works fine but minute functionality is not working. 日期选择工作正常,但minute功能不起作用。

When incrementing minute arrow, nothing happens, and on decrementing hour values gets decremented instead of minute value. incrementing分钟箭头时,什么也没有发生,并且在decrementing小时数时,值会减少而不是分钟数。

Here's my html snippet: 这是我的html代码段:

<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: 这是datetimepicker初始化:

$('.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. 其中'M''m'相同,因此您可能会因为使用月值而不是分钟值而感到困惑。 The minute value is declared by 'i' 分钟值由'i'声明

See more information here: https://www.malot.fr/bootstrap-datetimepicker/demo.php 在此处查看更多信息: https : //www.malot.fr/bootstrap-datetimepicker/demo.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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