HTML
xxxxxxxxxx
1
<div class="form-outline datetimepicker myDatetime">
2
<input type="text" class="form-control" id="datetimepickerDefault" />
3
<label for="datetimepickerDefault" class="form-label">Select Date and Time</label>
4
</div>
5
<br>
6
<button class="btn btn-secondary" id="btn">
7
Set default value
8
</button>
CSS
1
1
JS
xxxxxxxxxx
1
const btn = document.querySelector('#btn')
2
const dateTime = document.querySelector('.datetimepicker')
3
btn.addEventListener('click', () => {
4
mdb.Datetimepicker.getInstance(dateTime).dispose()
5
6
const myDatetimepicker = new mdb.Datetimepicker(document.querySelector('.myDatetime'), {
7
defaultDate: "22/01/2019",
8
defaultTime: "10:33 PM"
9
})
10
})
Console errors: 0