You are here

function date_all_day_date_combo_validate_date_start_alter in Date 7.3

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

Implements hook_date_combo_validate_date_start_alter().

File

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

Code

function date_all_day_date_combo_validate_date_start_alter(&$date, &$form_state, $context) {

  // 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. 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);
  }
}