Hi.
I’m used custom validation but don’t work.
I need to validate two dates. The start date must be less than the end date. I think with a custom validation can do it, but I have not made it work.
Even this small example not work.
    public function rules()
    {
        return [
            [['fechafactura', 'fechainicio',  'orden_numero'], 'required'],
            [['fechafactura', 'fechainicio', 'fechafin'], 'safe'],
            [['orden_numero'], 'integer'],
            ['fechafin', 'required_date'],
        ];
    }
    public function required_date($attribute, $params){
        if(empty($this->$atribute)){
            $this->addError($attribute, 'Date can not be empty');
        }
    }
anyone know where I 'm wrong. I hope you can help me.