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.

CommentFileSizeAuthor
date_combo_pre_validate_alter.diff1.28 KBDave Cohen

Comments

Status: Needs review » Needs work

The last submitted patch, date_combo_pre_validate_alter.diff, failed testing.

Anonymous’s picture

Issue summary: View changes

emphasis

Pls’s picture

Status: Needs work » Needs review

date_combo_pre_validate_alter.diff queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, date_combo_pre_validate_alter.diff, failed testing.