nova-time-field
nova-time-field copied to clipboard
Nova 4 support
For Laravel Nova 4, try:
Text::make('Departure Time')->withMeta(['type' => 'time']),
Result:
`
Where you found it??? It works!
It was from some helpful folk in the nova channel on the Laravel Discord.
Glad it works for you too.
I see you found the Discord chat and also made an improvement for formatting. Posting here in case it is useful to anyone else:
Text::make('Departure Time')
->withMeta(['type' => 'time'])
->displayUsing(function($value) {
return Carbon::parse($value)->format('H:i');
}),
@sutcliffe121 Just a small edit to handle nullable, otherwise it display the current time as the value.
Text::make('Start time', 'start_time')->withMeta(['type' => 'time'])->displayUsing(function($value) {
return $value ? Carbon::parse($value)->format('H:i') : '—';
}),