Validating a date with symfony using sfValidatorSchema
- by aaronfalloon
I'm using the following widget to allow a user to input a date
$this->widgetSchema['first_registration'] = new sfWidgetFormDate(array(
'format' => '%month%/%year%',
'years' => range(date('Y', time()) - 15, date('Y', time()) + 15)
));
The default format for a date using this widget is %month%/%day%/%year% and so that's what the default validator for this widget checks for. However, I've attempted to alter the validator...
$this->validatorSchema['first_registration'] = new sfValidatorDate(array(
'date_format' => '%month%/%year%',
'with_time' => false
));
This isn't working and I'm still getting an invalid error. Does anybody know why?