date compare

Hi Guys

I have two fields: start_date and expire_date, i have defined this rule in model:

[['start_date', 'compare', 'compareAttribute' => 'expire_date', 'operator' => '>='],'date'],

It does not work, what’s the problem?

Try this:

[['start_date', 'expire_date'] , 'date'],

['start_date', 'compare', 'compareAttribute' => 'expire_date', 'operator' => '>='],

thanks for reply

I do changed rules to:

[['start_date', 'expire_date'], 'date'],

['start_date', 'compare', 'compareAttribute' => 'expire_date', 'operator' => '<='],

and i fill fields with start_date: 2014-12-01, expire_date: 2014-12-18

error: Start Date must be less than or equal to "Expire Date".


So sorry for late reply, try this:

[['start_date', 'expire_date'], 'date', 'format' => 'yyyy-MM-dd'],

['expire_date', 'compare' , 'compareAttribute' => 'start_date', 'operator' => '>='],

it not works, when i am using datepicker format is DD/MM/YYYY in View