1 date.api.php hook_date_combo_validate_date_start_alter(&$date, &$form_state, $context)

Alter the local start date objects created by the date_combo validation.

This is called before the objects are converted back to the database timezone and stored.


object $date: The $date object.

array $form_state: A keyed array containing the current state of the form.

array $context: An associative array containing the following keys:

  • field: The $field array.
  • instance: The $instance array.
  • item: The $item array.
  • element: The $element array.


core/modules/date/date.api.php, line 205
Hooks provided by the Date module.


function hook_date_combo_validate_date_start_alter(&$date, &$form_state, $context) {
  // If this is an 'All day' value, set the time to midnight.
  if (!empty($context['element']['#date_is_all_day'])) {
    $date->setTime(0, 0, 0);