laraveldatelaravel-5.4laravelcollective

Laravel Collective date format


Is there a way to set Laravel Collective date picker format to yyyy-mm-dd?

I am using now:

{{ Form::date('deadline', null,['class' => 'form-control']) }}

but in the front end I get an input field with mm/dd/yyyy inside. I tried parsing the Carbon instance as second parameter, but that does nothing.

{{ Form::date('deadline', \Carbon\Carbon::now()->format('Y-m-d'),['class' => 'form-control']) }}

Solution

  • No, Laravel Collective does not provide this option.

    Use https://eonasdan.github.io/bootstrap-datetimepicker/

    {{ Form::text('deadline', null, ['class' => 'form-control', 'id'=>'datetimepicker']) }}
    

    Javascript

    $('#datetimepicker').datetimepicker({
        format: 'yyyy-mm-dd'
    });