date rules validation

i try this


array('age,'compare','operator'=>'<=', '1993-12-03'),

or this


array('age','compare','compareAttribute'=>"1993-12-03",'operator'=>'<'),

to validate that the input date were before 1993-12-03 in the models rules, but it did not works.

I call for help, any idea will be very appreciate. :slight_smile:

where?

in the public function rules() of the model file in \protected\models\ folder among the requiered, numerical, length, unique and safe validations.

http://www.yiiframework.com/wiki/56/

Look for:

compare : CCompareValidator

:frowning:

Did you figure it out?

not really, this is the closest that i’ll got


array('fnacimiento', 'match', 'pattern' => '%^19[1-9][0-9]-\d{2}-\d{2}$%', 'message' => 'Ingrese una fecha correcta'),

@quantico, Have you tried


array('age','compare','compareValue'=>'1993-12-03','operator'=>'<'),

That’s the syntax as per @jellysandwich link