Laravel Nova icon Nova Packages
D

Date Range Field

Readme

Date Range Field for Laravel Nova

Nova field for a Date Range Picker.

Install

Run this command in your nova project: composer require marshmallow/nova-date-range-field

How to use

Use the (dependend) DateRange Field class and define the name of the (from & till) fields and the label. If no fields are set the string value will be stored in the corresponding database column of the attribute.

    use Marshmallow\NovaDateRangeField\DateRange;

    public function fields(Request $request)
    {
        return [
             DateRange::make(__('Access Date'), ['from', 'till'])
                // OR
             DateRange::make(__('Access Date'))
                ->fields('from', 'till'),
        ];
    }

Aditional options from flatpickr can be used by adding them in the options array. These will overwrite the default options.

     DateRange::make(__('Date range'))
        ->fields('from', 'till')
        ->options([
            'defaultHour' => 0,
            'defaultMinute' => 0,
        ]),

Other field options (with their default values) are:

    ->modeType('range')
    ->range() // Default mode
    ->single() // default is disabled
    ->twelveHourTime() // default is disabled
    ->enableSeconds() // default is disabled
    ->separator('-')
    ->firstDayOfWeek(1)
    ->enableTime() // default is disabled
    ->dateFormat('Y-m-d')
    ->placeholder('date range')
    ->saveAsJSON() // default is disabled

Reviews

Rated 1 stars out of 5

By denisvasilievclarity on March 31, 2023

Doesn't work correctly. After save , can't view normally range and doesn't correct edit

Back to Top
Added 2 years ago
Last updated A Year Ago
Version v1.0.6
Composer
marshmallow/nova-date-range-field
GitHub stars 3
Packagist downloads 6,059

Favorites

0 users favorited

Rating

1.00
(out of 5)
★★★★★
★★★★
★★★
★★
1 ratings

Tags

Brought to you by Tighten

Issues/Feature Requests Stats Package Ideas