[英]How to set min date in Tempus Dominus bootstrap 4 datetimepicker
I'm having a hard time knowing the syntax as to how do i set the minDate to the current date as day passes by. 我很难知道如何将minDate设置为当前日期的语法。 Is there a way for me to set that way?
有没有办法让我这样做? Here is my code.
这是我的代码。
<script type="text/javascript">
$(function () {
// $('#datetimepicker1').datetimepicker();
var $dp1 = $("#datetimepicker1");
$dp1.datetimepicker({
//i dont know the syntax
});
});
</script>
Also, I'm having hard time to insert the values to my db.. maybe it has something to do with this. 此外,我很难将值插入我的数据库..也许它与此有关。
<div class="input-group date" id="datetimepicker1" data-target-
input="nearest">
<input type="text" name="eventDate" class="form-control
datetimepicker-input" data-target="#datetimepicker1"/>
<div class="input-group-append" data-
target="#datetimepicker1" data-toggle="datetimepicker">
<div class="input-group-text"><i class="fa fa-calendar">
</i></div>
</div>
</div>
Expected output should be that the available dates are just the current date and the dates onward. 预期输出应该是可用日期只是当前日期和日期。
You can use minDate function as below: 您可以使用minDate函数,如下所示:
<script type="text/javascript">
$(function () {
$('#datetimepicker1').datetimepicker({
minDate: new Date(),
// minDate: '03/06/2019',
format: 'MM/DD/YYYY H:s A'
});
});
</script>
Hope it helps you :) 希望它能帮到你:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.