在我的刀片文件中,我定义了:-
<div class="createMesh_row date" id="event_date_div">
<label>Event Date</label>
{{ Form::text('event_date','',array('id'=>'event_date','readonly', 'class' => '')) }}
<i class="fa fa-calendar eventdate"></i>
{{ $errors->first('event_date','<span class="error">:message</span>') }}
</div>
在我的js文件中:-
$( "#event_date,#target_date" ).datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'mm/dd/yyyy',
minDate: 0
});
我为此定义了规则:-
$rules=[
'title' =>'required',
'type' =>'required',
'privacy' =>'required',
'target_date' =>'required|date|date_format:"mm-dd-yyyy"',
// tried 'target_date' =>'required|date|date_format:"mm/dd/yyyy"',
// tried 'target_date' =>'required|date|date_format:"d/m/Y"',
// tried'target_date' =>'required|date_format:d-m-Y',
// not working
'occasion' =>'required'
];
错误:-
[target_date] => Array
(
[0] => The target date is not a valid date.
[1] => The target date does not match the format mm-dd-yyyy.
)