PHPackages                             wdelfuego/nova-datetime - 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. wdelfuego/nova-datetime

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

wdelfuego/nova-datetime
=======================

Makes working with DateTime fields in Laravel's Nova 4 easier

v1.1.2(3y ago)9111.4k↓32.1%5[3 issues](https://github.com/wdelfuego/nova-datetime/issues)[1 PRs](https://github.com/wdelfuego/nova-datetime/pulls)3MITPHPPHP ^7.4|^8.0

Since Apr 21Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/wdelfuego/nova-datetime)[ Packagist](https://packagist.org/packages/wdelfuego/nova-datetime)[ RSS](/packages/wdelfuego-nova-datetime/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (8)Used By (3)

This package adds a DateTime field with support for a global `DateTime` format, syntactic sugar for formatting individual `DateTime` fields and powerful date filters for Index views. It can serve as a base for more extensions and improvements with regard to `DateTime` fields and logic in Laravel's [Nova 4](https://nova.laravel.com).

Package is abandoned
====================

[](#package-is-abandoned)

As of 2025, I have moved my development efforts to [Filament](https://filamentphp.com) and am no longer using or working on this package.

You are free to make and distribute modified versions of this package publicly as long as you distribute it for free, as a stand-alone package and under the same dual licensing model.

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

[](#installation)

```
composer require wdelfuego/nova-datetime
```

Usage
-----

[](#usage)

### Formatting `DateTime` fields globally

[](#formatting-datetime-fields-globally)

1. First, publish this package's config file by running:

    ```
    php artisan vendor:publish --provider="Wdelfuego\Nova\DateTime\ServiceProvider"
    ```
2. Then, set the format you want to use for all of your `DateTime` fields in `config/nova-datetime.php`, for example:

    ```
    return [
        'globalFormat' => 'Y-M-d H:i:s',
    ];

    ```
3. In your Nova resource, replace all instances of `Laravel\Nova\Fields\DateTime` with instances of `Wdelfuego\Nova\DateTime\Fields\DateTime` by adding this use statement:

    ```
    use Wdelfuego\Nova\DateTime\Fields\DateTime;

    ```

This allows you to apply the global format to all `DateTime` fields in your own Nova resources automatically.

To automatically apply the global `DateTime` format to the 'Action Happened at' column of the action events in your resources' action logs as well, install the [wdelfuego/nova-actions](https://github.com/wdelfuego/nova-actions) package.

### Formatting individual `DateTime` fields

[](#formatting-individual-datetime-fields)

The examples below assume that the Eloquent model used for the Nova resource has an attribute named 'attribute'.

The `withDateFormat` helper is added automatically to all `DateTime` fields in your project (including Nova's own, so you don't have to use a custom DateTime field) and allows you to directly set the format you want the field to be displayed in:

```
    DateTime::make(__('Localized label'), 'attribute')
        ->withDateFormat('d-M-Y, H:i'),

```

It is simple syntactic sugar around the `displayUsing` method that works on DateTime fields [since Nova 4.2.4](https://github.com/laravel/nova-issues/discussions/3929#discussioncomment-2607539).

### Filtering resources by `DateTime` fields

[](#filtering-resources-by-datetime-fields)

You can use Laravel's native [`filterable`](https://nova.laravel.com/docs/4.0/resources/fields.html#filterable-fields) method on your `DateTime` fields for a standard date range filter or use any combination of the date filters below to give your end users powerful ways to filter their Nova resources from the Index view.

- `OnDate` only shows items where the DateTime field matches a specific date
- `NotOnDate` only shows items where the DateTime field is *not* on a specific date
- `AfterDate` only shows items where the DateTime field is after a specific date
- `AfterOrOnDate` only shows items where the DateTime field is either after or on a specific date
- `NotAfterDate` only shows items where the DateTime field is not after a specific date (this is a fully equivalent alias to `BeforeOrOnDate`)
- `BeforeDate` only shows items where the DateTime field is before a specific date
- `BeforeOrOnDate` only shows items where the DateTime field is either before or on a specific date
- `NotBeforeDate` only shows items where the DateTime field is not before a specific date (this is a fully equivalent alias to `AfterOrOnDate`)

You can add a combination of these filters to the Nova resource to allow end users to define a date range.

For example, you could make a standard date range filter that allows users to exclude a specific date like this:

```
use Wdelfuego\Nova\DateTime\Filters\AfterDate;
use Wdelfuego\Nova\DateTime\Filters\BeforeDate;
use Wdelfuego\Nova\DateTime\Filters\NotOnDate;

```

```
    public function filters(NovaRequest $request)
    {
        return [
            new AfterDate(__('After'), 'attribute'),
            new BeforeDate(__('Before'), 'attribute'),
            new NotOnDate(__('But not on'), 'attribute'),
        ];
    }

```

You can also filter for specific dates only using just a single `OnDate` filter, or force open-ended range filtering by adding just one of the `After` or `Before` filters.

Support
-------

[](#support)

For any problems, questions or remarks you might have, please open an issue on [GitHub](https://github.com/wdelfuego/nova-datetime).

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~14 days

Recently: every ~21 days

Total

7

Last Release

1400d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1326136?v=4)[wdelfuego](/maintainers/wdelfuego)[@wdelfuego](https://github.com/wdelfuego)

### Embed Badge

![Health badge](/badges/wdelfuego-nova-datetime/health.svg)

```
[![Health](https://phpackages.com/badges/wdelfuego-nova-datetime/health.svg)](https://phpackages.com/packages/wdelfuego-nova-datetime)
```

###  Alternatives

[optimistdigital/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2872.1M6](/packages/optimistdigital-nova-sortable)[ebess/advanced-nova-media-library

Laravel Nova tools for managing the Spatie media library.

6123.3M21](/packages/ebess-advanced-nova-media-library)[outl1ne/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2861.8M9](/packages/outl1ne-nova-sortable)[eminiarts/nova-tabs

Laravel Nova - Tabs.

4624.1M20](/packages/eminiarts-nova-tabs)[optimistdigital/nova-multiselect-field

A multiple select field for Laravel Nova.

3403.5M7](/packages/optimistdigital-nova-multiselect-field)[spatie/nova-tags-field

A tags field for Nova apps

3021.9M7](/packages/spatie-nova-tags-field)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
