function date_validate

Same name and namespace in other branches
  1. 6.x drupal-6.x/includes/form.inc \date_validate()

Validates the date type to prevent invalid dates (e.g., February 30, 2006).

Related topics

1 string reference to 'date_validate'
system_element_info in drupal-7.x/modules/system/system.module
Implements hook_element_info().

Archivo

drupal-7.x/includes/form.inc, line 2980
Functions for form and batch generation and processing.

Código

function date_validate($element) {
  if (!checkdate($element['#value']['month'], $element['#value']['day'], $element['#value']['year'])) {
    form_error($element, t('The specified date is invalid.'));
  }
}