public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('date_attribute', 'type', 'type' => 'date', 'message' => 'Please enter a valid date', 'dateFormat' => 'yyyy-MM-dd'),
array('date_attribute', 'isDueDateGreater'),
);
}
also we can check EXPIRY DATE must Greater than START DATE
we can wirte function in our Model and use it in rules
 public function isDueDateGreater($attribute, $params) {
         if( strtotime($this->expiry_date) < strtotime($this->start_date) ){ 
        $this->addError($attribute, 'Expiry date must be greater than start date.');}
       
}
