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?
Advertisement
Answer
I have to use defaultDate
property instead of minDate
:
$(function () { $('#datetimepicker').datetimepicker({ defaultDate: moment(), sideBySide: true }); });