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="text-left my-6 ">
<input class="form-control flatpickr_datetime py-2 px-4 rounded dark:border-secondary-600 bg-white dark:bg-dark-card border border-gray-200 w-full placeholder:text-gray-300 form-control flatpickr_datetime" type="text" placeholder="Select Date time.."
readonly="readonly">
</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",
})
}
})