date_combo_validate() invokes drupal_alter('date_combo_pre_validate', $element, $form_state, $context); which is nice, in theory, as a way to change the date values prior to validation.
In practice, date_combo_validate() calls $from_date = date_input_date($field, $instance, $element[$from_field], $posted[$from_field]);
Notice that the $from_date about to be validated is calculated from $posted, which is one of the variables not changeable in hook_date_combo_pre_validate_alter(). It's not passed in.
Seems to me there are two ways to fix. One is to use $element['value'] instead of $posted[$from_field] when calling date_input_date(). The other is to calculate $posted after drupal_alter() is called. The attached patch takes the latter approach.
| Comment | File | Size | Author |
|---|---|---|---|
| date_combo_pre_validate_alter.diff | 1.28 KB | Dave Cohen |
Comments
Comment #1.0
(not verified) commentedemphasis
Comment #2
Pls commenteddate_combo_pre_validate_alter.diff queued for re-testing.