You are here

function birthdays_field_views_handler_filter::birthdays_validate_date in Birthdays 7

Validate a date.

File

views/birthdays_field_views_handler_filter.inc, line 64
The birthdays_field_views_handler_filter class.

Class

birthdays_field_views_handler_filter
Handler that allows to filter by birthday fields.

Code

function birthdays_validate_date($element, $value, &$form_state) {
  try {
    $birthday = BirthdaysBirthday::fromString($value, TRUE);
    form_set_value($element, $birthday
      ->toString(), $form_state);
  } catch (InvalidArgumentException $e) {
    form_error($element, t('That is not a valid date.'));
  }
}