You are here

function _regcode_date_validate in Registration codes 7

Same name and namespace in other branches
  1. 6.2 regcode.admin.php \_regcode_date_validate()
  2. 7.2 regcode.admin.inc \_regcode_date_validate()

Ensure a blank date validates.

1 string reference to '_regcode_date_validate'
regcode_admin_create in ./regcode.admin.php
Create registration codes form.

File

./regcode.admin.php, line 312
Functions and pages needed for the admin UI of regcode module.

Code

function _regcode_date_validate($element) {
  $blank = TRUE;
  foreach (array(
    'year',
    'month',
    'day',
  ) as $field) {
    $blank = $blank && $element[$field]['#value'][0] === '0';
  }
  if ($blank) {
    return TRUE;
  }
  return date_validate($element);
}