PHPackages                             michielfb/laravel-nova-time-field - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. michielfb/laravel-nova-time-field

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

michielfb/laravel-nova-time-field
=================================

A HTML5 time field for Laravel Nova.

2.1.0(1y ago)21415.1k—0.3%4MITPHPPHP ^7.3|^8.0

Since Oct 1Pushed 1y ago1 watchersCompare

[ Source](https://github.com/michielfb/laravel-nova-time-field)[ Packagist](https://packagist.org/packages/michielfb/laravel-nova-time-field)[ RSS](/packages/michielfb-laravel-nova-time-field/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (13)Used By (0)

Laravel Nova Time Field
=======================

[](#laravel-nova-time-field)

This package adds a basic HTML5 time field to Laravel Nova.

Requirements
------------

[](#requirements)

This package require laravel/nova:~4.0.

Installation
------------

[](#installation)

Use composer to install the package.

```
composer require michielfb/laravel-nova-time-field
```

Usage
-----

[](#usage)

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](https://nova.laravel.com/docs/4.0/resources/fields.html).

### Format

[](#format)

Use the `format` method to customize how to date is shown to users. The format must be a [PHP date format](https://www.php.net/manual/en/datetime.format.php).

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', '-');
```

### Steps

[](#steps)

The [step attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time#Using_the_step_attribute)can be configured by using the `withSteps` method.

```
