'Laravel Nova set global DateTime format
Is there a way to set formatting on a global level for Laravel Nova?
Currently I have to do something like this all over the place:
DateTime::make('Created At')->sortable()->format('D-M-yyyy H:m'),
Preferably I would just want all DateTime instances to be formatted like this.
Solution 1:[1]
I would suggest extending the default DateTime field to App\Nova\Fields\DateTime and you can have more control on how to define the default for each project.
https://crynobone.com/extending-default-fields-on-laravel-nova/
Solution 2:[2]
For Nova 4 users; you can use my (MIT licensed) package wdelfuego/nova-datetime to add support for a configurable global DateTime format to your fields.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | crynobone |
| Solution 2 | Wilbo Baggins |
