Hello,
Is it possible to customize datepicker options in form element based on form field ID?
I’m building a basic booking form, where I want to use two datepicker fields: one - to pick a date and the other one - to pick time.
For example, for my date field with ID ‘abcd’ I could use something like this:
add_filter('bricks/element/form/datepicker_options', function($options, $element) {
// Set the minimum date to today for the date field with ID 'abcd'
$options['minDate'] = 'today';
return $options;
}, 10, 2);
and for my time field with ID ‘efjk’:
add_filter('bricks/element/form/datepicker_options', function($options, $element) {
// Disable calendar for the time field with ID 'efjk'
$options['enableTime'] = true;
$options['noCalendar'] = true;
$options['dateFormat'] = 'H:i';
return $options;
}, 10, 2);
Also, when disabling calendar in flatpickr for time field the input data still has date in it.
I appreciate any help.