Since Yii2 2.04 it is possible to write:
public function rules()
{
return [
['birthdate', 'date', 'format' => 'd-m-Y',
'max' => '31-12-2010',
'min' => '01-01-1900',
'tooBig' => 'Too young.',
'tooSmall' => 'Too old.'],
However, if I use the Kartik datepicker, these rules are not checked.
If I enter for example "13-11-20156" -> an 6 too many, with the above rules, I get the error:
Invalid Parameter – yii\base\InvalidParamException
‘13-11-20158’ is not a valid date time value: DateTime::__construct(): Failed to parse time string (13-11-20156) at position 10 (: Unexpected character
Array.
A form without the Kartik datepicker works fine and gives the correct errormessages.
The question is of course why?