1.20.x date.api.php hook_date_combo_validate_date_end_alter(&$date, &$form_state, $context)

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

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

Parameters

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.

File

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

Code

function hook_date_combo_validate_date_end_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);
  }
}