document.addEventListener('DOMContentLoaded', function() { "use strict"; var config = { dtLocal: { enableTime: true, altInput: true, altFormat: "j. F Y, H:i", dateFormat: "Y-m-dTH:i", time_24hr: true }, d: { altFormat: "j. F Y", dateFormat: "Y-m-d", altInput: true }, t: { enableTime: true, noCalendar: true, altFormat: "H:i", dateFormat: "H:i", altInput: true, time_24hr: true } }; Array.from(document.querySelectorAll('input[type="date"]')).forEach(function(el) { flatpickr(el, config.d); }); Array.from(document.querySelectorAll('input[type="time"]')).forEach(function(el) { flatpickr(el, config.t); }); Array.from(document.querySelectorAll('input[type="datetime-local"]')).forEach(function(el) { flatpickr(el, config.dtLocal); }); });