I’ve seen the following snippet used to disable direct input of the date when datepicker is available – requiring users select from the datepicker. Note: Unsure what effect this may have on accessibility.
// Disable direct date input when datepicker is active
add_filter( 'gform_field_content', function ( $content, $field, $value, $lead_id, $form_id ) {
if ( $field instanceof GF_Field_Date && $field->dateType == 'datepicker' ) {
$content = str_replace( "class='datepicker", "onfocus='blur();' class='datepicker" , $content );
}
return $content;
}, 10, 5 );