Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

seco's avatar
Level 1

validating date not working

i have a validation rule for date as follows

 'date' => 'required|date|date_format:"d/m/Y"',

and i have a jquery date picker on the page and it shows the date

with a format

      $('.datepicker').datepicker({
         dateFormat: 'dd/mm/yy'
       });

and show the date like this

12/09/2016

when i enter date like the above it saves well and when i just choose another date 13/09/2016 it return error says The date is not a valid date !!!

although the same code without any change !!! but just a different date

0 likes
1 reply
tomopongrac's avatar
Level 51

From documentation

date_format:format

The field under validation must match the given format. The format will be evaluated using the PHP date_parse_from_format function. You should use either date or date_format when validating a field, not both.

https://laravel.com/docs/5.3/validation

You can not use date and date_format in same rule

3 likes

Please or to participate in this conversation.