Search code examples
phplaraveldatedatepickerphp-carbon

Setting a default value for a date input field with laravel carbon


I have an date input field using Laravel Carbon. It has a now() method attached to the Carbon class eg.

{{Form::date('toDate', \Carbon\Carbon::now(), ['class' => 'form-control'])}}

On screen the input's default value displays today's date eg. 23/10/2018. Is there any way I can remove this to display "mm/dd/yy" as the initial value and then the user can select whatever date?


Solution

  • It shows the date because you use Carbon, you can use null as a default value, and in the array of options (next to the class) just add:

    'placeholder' => 'mm/dd/yyyy'