From ee12ae649339c95c4a7a96aa95cb93d465a1d6f9 Mon Sep 17 00:00:00 2001 From: Dries Buytaert <dries@buytaert.net> Date: Mon, 15 May 2006 06:27:32 +0000 Subject: [PATCH] - Patch #63251 by sammys: added validation of dates. --- includes/form.inc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/includes/form.inc b/includes/form.inc index 5e0a3a12c56e..35333e5fec3c 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -830,6 +830,15 @@ function expand_date($element) { return $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. */ -- GitLab