admin管理员组文章数量:1426066
My Bootstrap 3 Datetimepicker is configured as:
$(function () {
$('#datetimepicker').datetimepicker({
minDate: moment(),
keepInvalid: $('#start_date').val() ? true : false,
sideBySide: true
});
});
What I really need is to show the current date and time (like moment()
function does) only if the value of the input form is empty (i.e. the appropriate field in the database is empty). And do not show the current date&time if the value is set.
In the current configuration it always shows me the current date & time ignoring the value from the database. Any ideas?
My Bootstrap 3 Datetimepicker is configured as:
$(function () {
$('#datetimepicker').datetimepicker({
minDate: moment(),
keepInvalid: $('#start_date').val() ? true : false,
sideBySide: true
});
});
What I really need is to show the current date and time (like moment()
function does) only if the value of the input form is empty (i.e. the appropriate field in the database is empty). And do not show the current date&time if the value is set.
In the current configuration it always shows me the current date & time ignoring the value from the database. Any ideas?
Share Improve this question edited May 27, 2022 at 16:17 Andremoniy asked Apr 25, 2016 at 14:05 AndremoniyAndremoniy 35k24 gold badges142 silver badges254 bronze badges1 Answer
Reset to default 2I have to use defaultDate
property instead of minDate
:
$(function () {
$('#datetimepicker').datetimepicker({
defaultDate: moment(),
sideBySide: true
});
});
本文标签: javascriptBootstrap datetimepicker current date and current time by defaultStack Overflow
版权声明:本文标题:javascript - Bootstrap datetimepicker current date and current time by default - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745349352a2654670.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论