In one of the projects I worked on recently, we had to use the Drupal date module to display the date field in a custom form. This modules adds a description field that is not always wanted. It can be removed using the following code snippet in your custom module.
Drupal remove date module description
/**
* implements hook_element_info_alter()
*
*/
function MYMODULE_element_info_alter(&$type) {
if (isset($type['date_popup'])) {
$type['date_popup']['#process'][] = 'MYMODULE_date_popup_process_alter';
}
}
/**
* function to remove the description from date_popup
*
*/
function MYMODULE_date_popup_process_alter(&$element, &$form_state, $context) {
unset($element['date']['#description']);
return $element;
}
If you are using Drupal’s Bootstrap base theme the description field becomes the “data-original-title” attribute on the input field, that gets turned into a pretty cool popover, however in our case we didn’t need it. Using the code above I was able to remove it.