date rules validation

i try this

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

or this


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:


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

Look for:

compare : CCompareValidator


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


That’s the syntax as per @jellysandwich link