Documentation

Flatpickr

flatpickr is a lightweight and powerful datetime picker. Use the required class varient (e.g. range_flatpicker, date_flatpicker, wrap_flatpicker active ) for different flatpickr. For more details

HTML Code

<div class="input-group">
    <input type="text" id="myDatepicker" class="form-control" placeholder="Date Picker">
</div>

Script

const datetime = document.querySelectorAll('.flatpickr_datetime')
Array.from(datetime, (elem) => {
  if(typeof flatpickr !== typeof undefined) {
    flatpickr(elem, {
        enableTime: true,
        dateFormat: "Y-m-d H:i",
    })
  }
})