summaryrefslogtreecommitdiff
path: root/includes/form.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2006-05-15 06:27:32 +0000
committerDries Buytaert <dries@buytaert.net>2006-05-15 06:27:32 +0000
commitee12ae649339c95c4a7a96aa95cb93d465a1d6f9 (patch)
treeb75b9683a71dfedaffc69e50ebeeda0a3667f1af /includes/form.inc
parent37a9229dba2e8807edcd37fc7d6a9911a24cc00a (diff)
downloadbrdo-ee12ae649339c95c4a7a96aa95cb93d465a1d6f9.tar.gz
brdo-ee12ae649339c95c4a7a96aa95cb93d465a1d6f9.tar.bz2
- Patch #63251 by sammys: added validation of dates.
Diffstat (limited to 'includes/form.inc')
-rw-r--r--includes/form.inc9
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) {