suncoastkid suncoastkid - 7 months ago 21
PHP Question

Laravel 4 Validation is Broken

A simple date format mm/dd/yyyy validation is all I need...

$rules = array(
'renewal_date' => array('required', 'date_format:?')
);


What do I set the date format to? The Laravel documentation could be so much better.

Answer

Workaround:

'renewal_date' => array('required', 'date_format:m/d/Y', 'regex:/[0-9]{2}\/[0-9]{2}\/[0-9]{4}/')