I want to compare 2 dates in rules.
When I enter the same date in start_date and end_date, I get the error message "End must be greater than or equal to Start"
The start_date and end_date are datetime fields.
I’m looking for a solution.
return [
['end_date', 'date', 'format' => 'php:Y-m-d H:i:s', 'skipOnEmpty' => false],
['start_date', 'date', 'format' => 'php:Y-m-d H:i:s', 'skipOnEmpty' => false],
['end_date', 'compare', 'compareAttribute' => 'start_date', 'operator' => '>'],
];