diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/form.inc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/includes/form.inc b/includes/form.inc index 5e0a3a12c..35333e5fe 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -831,6 +831,15 @@ function expand_date($element) { } /** + * Validates the date type to stop dates like February 30, 2006. + */ +function date_validate($form) { + if (!checkdate($form['#value']['month'], $form['#value']['day'], $form['#value']['year'])) { + form_error($form, t('The specified date is invalid.')); + } +} + +/** * Helper function for usage with drupal_map_assoc to display month names. */ function map_month($month) { |