A HTML5 time field for Laravel Nova.
michielfb/laravel-nova-time-field is a Laravel package for a html5 time field for laravel nova..
It currently has 20 GitHub stars and 472.108 downloads on Packagist (latest version 2.1.0).
Install it with composer require michielfb/laravel-nova-time-field.
Discover more Laravel packages by michielfb
or browse all Laravel packages to compare alternatives.
Last updated
This package adds a basic HTML5 time field to Laravel Nova.
This package require laravel/nova:~4.0.
Use composer to install the package.
composer require michielfb/laravel-nova-time-field
The example below shows how to create a Time field where users can enter hours, minutes, and seconds. The time is show in the "h:i A" format (For example 11:15 PM). When no value is entered the value "n/a" is shown.
use Michielfb\Time\Time;
Time::make('Time')
->withSeconds()
->format('h:i A', 'n/a');
For documentation on how to add fields to a resource see the Laravel Nova documentation.
Use the format method to customize how to date is shown to users. The format must be a
PHP date format.
A default value can be passed to the format method. This determines the value shown to users if there is no
value entered.
use Michielfb\Time\Time;
Time::make('Time')
->format('h:i A', '-');
The step attribute
can be configured by using the withSteps method.
<?php
use Michielfb\Time\Time;
Time::make('Time')->withSteps(1);
The withSeconds method sets a step of 1 which allows users to enter seconds.
<?php
use Michielfb\Time\Time;
Time::make('Time')->withSeconds();
The withMilliseconds method sets a step of 0.001 which allows users to enter milliseconds.
<?php
use Michielfb\Time\Time;
Time::make('Time')->withMilliseconds();