You are here

function webform_civicrm_datetime_set_format in Webform CiviCRM Integration 8.5

Remove seconds from the HTML5 datetime widget.

1 string reference to 'webform_civicrm_datetime_set_format'
webform_civicrm_element_info_alter in ./webform_civicrm.module
Implements hook_element_info_alter().

File

./webform_civicrm.module, line 56
Webform CiviCRM Integration Module: Links webform submissions to contacts in a CiviCRM database. @author Coleman Watts

Code

function webform_civicrm_datetime_set_format($element) {
  if (!empty($element['#date_time_element']) && $element['#date_time_element'] == 'time' && !empty($element['time']['#value'])) {
    $parts = explode(':', $element['time']['#value']);
    $parts = array_splice($parts, 0, 2);
    $element['time']['#value'] = implode(':', $parts);
  }
  return $element;
}