Elementor – Customize Flatpickr (Date and Time)

jQuery(document).ready(function($) {
function waitForFlatpicker(callback) {
if (typeof window.flatpickr !== 'function') {
setTimeout(function() {
waitForFlatpicker(callback);
}, 100);
}

callback();
}

waitForFlatpicker(function() {
if (typeof flatpickr === 'undefined') {
return;
}

flatpickr.l10ns.de = {
weekdays: {
shorthand: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
longhand: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag']
},
months: {
shorthand: ['Jan', 'Feb', 'März', 'Apr', 'Mai', 'Juni', 'Juli', 'Aug', 'Sept', 'Okt', 'Nov', 'Dez'],
longhand: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember']
},
rangeSeparator: ' bis '
};

flatpickr.localize(flatpickr.l10ns.de);
flatpickr('.flatpickr-input');

setTimeout(function() {
$('.flatpickr-input[name="form_fields[date]"]').each(function() {
$(this).flatpickr({
disable: [
function(date) {
return (date.getDay() === 1);
}
],
dateFormat: 'd.m.Y',
minDate: 'today',
locale: {
firstDayOfWeek: 1
}
});
});

$('.flatpickr-input[name="form_fields[time]"]').each(function() {
$(this).flatpickr({
enableTime: true,
noCalendar: true,
dateFormat: 'H:i',
time_24hr: true
});
});
}, 1000);
});
});