Index: date.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/webform/components/date.inc,v retrieving revision 1.25 diff -u -r1.25 date.inc --- date.inc 9 Feb 2010 05:39:08 -0000 1.25 +++ date.inc 9 Feb 2010 07:33:32 -0000 @@ -120,7 +120,6 @@ '#required' => $component['mandatory'], '#webform_component' => $component, '#process' => array('webform_expand_date'), - '#element_validate' => array('webform_validate_date'), ); if (isset($value)) { @@ -248,8 +247,11 @@ } // Check the date is between allowed years. if ($element['year']['#value'] !== '' && is_numeric($component['extra']['year_start']) && is_numeric($component['extra']['year_end'])) { - if ($element['year']['#value'] < $component['extra']['year_start'] || $element['year']['#value'] > $component['extra']['year_end']) { - form_set_error($form_key .'][year', t('The entered date needs to be between the years @start and @end.', array('@start' => $component['extra']['year_start'], '@end' => $component['extra']['year_end']))); + // Allow years to be in reverse order. + $start = $component['extra']['year_start'] < $component['extra']['year_end'] ? $component['extra']['year_start'] : $component['extra']['year_end']; + $end = $component['extra']['year_start'] > $component['extra']['year_end'] ? $component['extra']['year_start'] : $component['extra']['year_end']; + if ($element['year']['#value'] < $start || $element['year']['#value'] > $end) { + form_set_error($form_key .'][year', t('The entered date needs to be between the years @start and @end.', array('@start' => $start, '@end' => $end))); return; } }