All Projects → laraning → Nova Time Field

laraning / Nova Time Field

Licence: mit
Laravel Nova Time Field

Projects that are alternatives of or similar to Nova Time Field

Laravel Nova Nested Form
This package allows you to include your nested relationships' forms into a parent form.
Stars: ✭ 169 (+275.56%)
Mutual labels:  laravel, nova
Nova Tags Field
A tags field to use in your Nova apps
Stars: ✭ 204 (+353.33%)
Mutual labels:  laravel, nova
Nova Impersonate
A Laravel Nova field allows you to authenticate as your users.
Stars: ✭ 182 (+304.44%)
Mutual labels:  laravel, nova
Nova Cashier Manager
Managing Stripe subscriptions inside the incredible Laravel Nova admin panel.
Stars: ✭ 150 (+233.33%)
Mutual labels:  laravel, nova
Laravel Nova Lang
🌌 Language files for Laravel Nova translated into 40+ languages. Feel free to submit your language or update an existing one!
Stars: ✭ 275 (+511.11%)
Mutual labels:  laravel, nova
Schedule
Schedule is a package that helps tracking schedules for your models. If you have workers in a company, you can set schedules for them and see their availability though the time.
Stars: ✭ 155 (+244.44%)
Mutual labels:  laravel, time
Skeleton Nova Tool
A skeleton repository for Spatie's Nova Packages
Stars: ✭ 191 (+324.44%)
Mutual labels:  laravel, nova
Nova Translatable
Making Nova fields translatable
Stars: ✭ 119 (+164.44%)
Mutual labels:  laravel, nova
Nova Tabs
Laravel Nova Tabs Package
Stars: ✭ 265 (+488.89%)
Mutual labels:  laravel, nova
Nova Backup Tool
A Laravel Nova tool to backup your app
Stars: ✭ 260 (+477.78%)
Mutual labels:  laravel, nova
Nova Slug Field
Slug field for Laravel Nova
Stars: ✭ 131 (+191.11%)
Mutual labels:  laravel, nova
Scout Extended
Scout Extended: The Full Power of Algolia in Laravel
Stars: ✭ 330 (+633.33%)
Mutual labels:  laravel, nova
Nova Settings Tool
Laravel Nova tool to view and edit application settings.
Stars: ✭ 131 (+191.11%)
Mutual labels:  laravel, nova
Laravel Nova Localizations
🌎 Localization files for Laravel Nova
Stars: ✭ 161 (+257.78%)
Mutual labels:  laravel, nova
Nova Repeatable Fields
A Laravel Nova field for configuring repeatable sets of fields
Stars: ✭ 126 (+180%)
Mutual labels:  laravel, nova
Nova Filemanager
A Filemanager tool for Laravel Nova
Stars: ✭ 189 (+320%)
Mutual labels:  laravel, nova
Nova Indicator Field
A colour-coded indicator field for Laravel Nova
Stars: ✭ 108 (+140%)
Mutual labels:  laravel, nova
Nova Tail Tool
A Laravel Nova tool to display the application log
Stars: ✭ 110 (+144.44%)
Mutual labels:  laravel, nova
Laravel Nova Excel
🚀 Supercharged Excel exports for Laravel Nova Resources
Stars: ✭ 259 (+475.56%)
Mutual labels:  laravel, nova
Nova Permission
A Laravel Nova tool for Spatie's laravel-permission library
Stars: ✭ 294 (+553.33%)
Mutual labels:  laravel, nova

A time field for Laravel Nova applications

Latest Version on Packagist StyleCI Total Downloads

This package contains a Nova field to allow you to store time values. Under the hood it uses the flatpickr default Laravel Nova Calendar library.

screenshot of the nova time field

Installation

You can install this package in your Laravel Nova app via composer:

composer require laraning/nova-time-field

Usage

You can use the Laraning\NovaTimeField\TimeField namespace in your Nova resource:

namespace App\Nova;

use Laraning\NovaTimeField\TimeField;

class BlogPost extends Resource
{
    // ...

    public function fields(Request $request)
    {
        return [
            // ...

            TimeField::make('Post start Time'),
            // ...
        ];
    }
}

By default the time component uses a 24 hour format. Still you can make it in 12h format like:

TimeField::make('Post start Time')->withTwelveHourTime(),

You can also change the default 5 minute increments to another number:

TimeField::make('Post start Time')->minuteIncrement(1),

You can make sure that all times entered are converted back to your base app timezone (set in config/app.php) by calling the withTimezoneAdjustments() method on your field.

TimeField::make('Post start Time')->withTimezoneAdjustments(),

An example of this would be when your app is set to GMT but your user is in BST (GMT+1). The user would still be able to interact with the timefield in their local time, but the time would be saved into the database in GMT.

E.G. The user may select 14:00. They will always see the time as 14:00, but the database will save it as 13:00 as it makes the BST -> GMT adjustments behind the scenes.

As well as handling switching the time to and from your base app timezone, you may also pass in a timezone offset (in minutes), such as the one returned by moment().utcOffset(). This will then adjust the time to display with the adjusted timezone rather than the users timezone. This is useful if you're saving the time in UTC along with the offset of the browser that was used to submit it.

Here you can see how we'd move UTC to BST by passing an offset of 60

TimeField::make('Post start Time')->withTimezoneAdjustments(60),

Current development status

  • [x] Make release 0.1.0.
  • [ ] Add minimal test scenarios.
  • [x] Add timezone support.

Changelog

Please see CHANGELOG for more information on what has changed recently.

License

The MIT License (MIT). Please see License File for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].