I want a picker to be set to a month in the future by default. This works fine:
<script type="text/javascript">
$(function () {
$('#enddatepicker').datetimepicker({
defaultDate: moment().add(1, 'M').toDate(),
locale: 'de',
format: 'DD.MM.YYYY'
});
});
</script>
However, I also want the date to be not before tomorrow. So I try adding a minDate option:
<script type="text/javascript">
$(function () {
$('#enddatepicker').datetimepicker({
minDate: moment().add(1, 'd').toDate(),
defaultDate: moment().add(1, 'M').toDate(),
locale: 'de',
format: 'DD.MM.YYYY'
});
});
</script>
However, now the default date is set to minDate (that is, tomorrow). Can I set a default date independently from the minimum date?
Looking at the code on GitHub (line 1674) if you set the option useCurrent to false, your default may not be overridden:
<script type="text/javascript">
$(function () {
$('#enddatepicker').datetimepicker({
useCurrent: false,
minDate: moment().add(1, 'd').toDate(),
defaultDate: moment().add(1, 'M').toDate(),
locale: 'de',
format: 'DD.MM.YYYY'
});
});
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With