Date

You're browsing the documentation for an old version of MoonShine. Consider upgrading your project to MoonShine 2.x.

Extends Text * has the same features

Input has date type and additional method - format

use MoonShine\Fields\Date;
 
//...
public function fields(): array
{
return [
Date::make('Creation date', 'created_at')
->format('d.m.Y') // Date display format on the main resource
];
}
 
//...

Use the withTime method to display not only the date but also the time in the field

use MoonShine\Fields\Date;
 
//...
public function fields(): array
{
return [
Date::make('Date and time of creation', 'created_at')
->withTime()
];
}
 
//...