Skip to content
Snippets Groups Projects

Issue # 3518920: Modified initial files to support the new library

Files
7
js/flatpickr.js 0 → 100644
+ 31
0
/**
* @file
*
* Callback for flatpickr.
*/
(function ($) {
Drupal.behaviors.flatpickr = {
attach:(context, settings) => {
const fieldName = [];
Object.keys(settings.timepicker.flatpickr_timepicker).forEach((key, index) => {
if (key !== null) {
fieldName[index] = key;
}
});
const requiredOptions = {
enableTime: true,
noCalendar: true,
dateFormat: "H:i",
};
for (let i = 0; i < fieldName.length; i++) {
$('input[name="' + fieldName[i] + '[' + i + '][value][time]"').flatpickr(requiredOptions);
}
}
};
}(jQuery));
Loading