0

I am using Laravel5.2 and the LaravelCollective form and html helpers.

I have a field in my database called fixture_date which is of type datetime.

In my view I am using

{{ Form::label('fixture_date', 'Date:') }}
{{ Form::date('fixture_date', \Carbon\Carbon::now()) }}

This just produces a date selector and when submitted enters 2017-01-12 00:00:00 into the database.

If i change my view to

{{ Form::label('fixture_date', 'Date:') }}
{{ Form::time('fixture_date', \Carbon\Carbon::now()) }}

I get a time selector but when I submit then I get an error as data is missing ( the date part)

Is there a way of getting a datetime selector in there for that field as I need this for both create and update.

Thank you

Greyhounddad
  • 115
  • 3
  • 9

1 Answers1

3

Try using the format method available:

{{ Form::time('fixture_date', Carbon\Carbon::now()->format('H:i')) }} as the time field is expecting this 24 hour time format by default.

Jonathan
  • 10,936
  • 8
  • 64
  • 79