You are here

function date_all_day_date_combo_validate_date_end_alter in Date 8

Same name and namespace in other branches
  1. 7.3 date_all_day/date_all_day.module \date_all_day_date_combo_validate_date_end_alter()
  2. 7.2 date_all_day/date_all_day.module \date_all_day_date_combo_validate_date_end_alter()

Implements hook_date_combo_validate_date_end_alter().

This hook lets us alter the local date objects created by the date_combo validation before they are converted back to the database timezone and stored.

File

date_all_day/date_all_day.module, line 339
Adds All Day functionality to the Date field.

Code

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