Hi @roffdaniel you need to pass date in the same format (d.m.Y) to after_or_equal and before_od_equal rules, not the timestamp
Sep 22, 2020
9
Level 1
Date rules
Hi, everybody. Please tell me how I can correctly use the rules 'after_or_equal' and 'before_or_equal' if the format of the entered date is 'd. m. Y'? I specify the correct date, the validator does not swear(I send the form via AJAX), but I still get an error about an incorrect date...
Thank in advance!
public function rules()
{
return [
'pName' => ['required', 'string', 'max:25', 'regex:/([A-Z]{1}[a-z]{1,24})_([A-Z]{1}[a-z]{1,24})/', 'unique:players,pName'],
'pSex' => ['required'],
'pSkin' => ['required'],
'pBirthday' => ['required', 'date_format:d.m.Y', 'after_or_equal:-631162800', 'before_or_equal:1135987200'],
'pBiography' => ['required', 'min:300', 'max:500']
];
}
Please or to participate in this conversation.