Index: scheduler.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/scheduler/Attic/scheduler.module,v
retrieving revision 1.46.4.29
diff -u -p -r1.46.4.29 scheduler.module
--- scheduler.module	28 Apr 2008 12:09:01 -0000	1.46.4.29
+++ scheduler.module	7 May 2008 16:47:29 -0000
@@ -66,6 +66,9 @@ function scheduler_form_alter($form_id, 
       // if scheduling has been enabled for this node type
       if (variable_get('scheduler_'. $form['type']['#value'], 0) == 1) {
 
+        // We add the additional validation function this way to preserve any existing validation function
+        $form['#validate']['_scheduler_form_validate' ] = array();
+
         //use JScalendar picker for dates if the module exists and is enabled
         $jscalendar = FALSE;
         if (module_exists('jscalendar')) {
@@ -143,6 +146,34 @@ function scheduler_form_alter($form_id, 
   }
 }
 
+
+/**
+ * Implementation of hook_form_validate()
+ * Validate the input of the publish and unpublish date fields
+ */
+function _scheduler_form_validate($form_id, $form) {
+
+  $publishtime = FALSE;
+  $unpublishtime = FALSE;
+
+  if (isset($form['publish_on']) && (trim($form['publish_on']) != "")) {
+    $publishtime = strtotime($form['publish_on']);
+    if ($publishtime === FALSE) {
+      form_set_error('publish_on', t('The entered publication date is invalid.'));
+    }
+  }
+
+  if (isset($form['unpublish_on']) && (trim($form['unpublish_on']) != "")) {
+    $unpublishtime = strtotime($form['unpublish_on']);
+    if ($unpublishtime === FALSE) {
+      form_set_error('unpublish_on', t('The entered expiration date is invalid.'));
+    }
+    else if (isset($form['publish_on']) && $unpublishtime < $publishtime) {
+      form_set_error('unpublish_on', t("The expiration date is before publication date."));
+    }
+  }
+}
+
 /**
  * Implementation of hook_nodeapi().
  */
