Hi all. Im trying to validate the birthdate in my form: Code: pastebin link
My issue is, how do I validate the correct format? Im going for d-m-Y, but as i know, by default html forces input type=date as: Y-m-d instead, and I'm struggling to kinda convert it to reflect a real validation?
If i validate it as Y-m-d, everything is fine, but if i try to validate it as d-m-Y like 01-06-1991, it gives me this error: The birthday does not match the format d-m-Y.
How do I work around this?
I tried to validate like this without any luck:
'birthday' => ['required', 'string', 'max:100', 'date_format:d-m-Y'],
First of all the date shouldn't be a 'string' type. However if that works for you fine.
You could put this in your model.
protected $dateFormat = 'Y-d-m';
Or whatever the format you're using.
Ive tried protected $dateFormat = 'd-m-Y H:i:s';
But it gave me a mysql error. Seems like mysql cant like that format then :S
Check this out I think this is exactly what you need.
https://laracasts.com/discuss/channels/general-discussion/how-to-carbonparse-in-ddmmyyyy-format
Through our experts, we offer all kinds of Psychology Writing Services and Psychology Coursework Writing Help to suit the need of every student when they are given any Psychology Research Paper Writing Services. https://researchpapers247.com/psychology-writing-services/
When students seek our Psychology Writing Services from us, they are assured to receive Custom Psychology Writing Services that meets all their writing needs and Online Psychology Writing Services one that has been written following all the instructions. https://www.meldaresearch.com/psychology-writing-services/
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community