xxxxxxxxxx
1
<div class="row m-3">
2
<div class="col-sm-3 col-md-3 col-lg-3 wrapper">
3
4
</div>
5
</div>
1
1
xxxxxxxxxx
1
const datetimepickerTemplate = `
2
<div class="form-outline datetimepicker pubdatetime" data-mdb-toggle-button="false">
3
<input
4
type="text"
5
class="form-control"
6
id="pubdate"
7
data-mdb-toggle="datetimepicker"
8
data-mdb-formatDate='dd/mm/yyyy HH:MM'
9
/>
10
<label for="pubdate" class="form-label">Select Date and Time</label>
11
</div>
12
`
13
14
const wrapper = document.querySelector('.wrapper')
15
16
wrapper.insertAdjacentHTML('beforeend', datetimepickerTemplate);
17
18
19
document.querySelectorAll('.form-outline').forEach((formOutline) => {
20
new mdb.Input(formOutline).init();
21
});
22
23
let startdate ='25/02/2022';
24
let starttime = '09:23 AM'
25
26
const myDatetimepicker = new mdb.Datetimepicker(document.querySelector('.pubdatetime'), {
27
defaultDate:startdate,
28
defaultTime: starttime
29
});
Console errors: 0