I'm working with Laravel Backpack and for a specific model I want the user to be able to add a "start time" using the time
field type. I want the user to enter this format: hh:mm
.
While creating the entity it works fine. But in the edit mode the value of the input field has this format: hh:mm:ss
The field is declared like this:
[
'name' => 'start_time',
'label' => "Beginn",
'type' => 'time'
],
The corresponding field in the DB looks like this:
$table->time('start_time')->nullable();
When the model is created this works as expected what means, that I can enter the time in hh:mm
format. For example I enter "14:00".
After saving the model, in the DB I have the value stored as 14:00:00
.
Now, when I go to the edit view the value in the corresponding time input field is also 14:00:00
.
I assume this is because in the DB the value is stored including the seconds.
Is it possible to store a time in the DB without the seconds? So just in the format hh:mm
?
For more details I have some screenshots that show what I meant:
On creation enter image description here enter image description here
The value in DB after saving enter image description here
The input after loading the edit view enter image description here