Extends
Text
* has the same features
The Date field is an extension of Text,
which by default sets type=date
and has additional methods.
use MoonShine\Fields\Date; //... public function fields(): array{ return [ Date::make('Created at', 'created_at') ];} //...
# Date and time
Using the withTime()
method allows you to enter a date and time into a field.
withTime()
use MoonShine\Fields\Date; //... public function fields(): array{ return [ Date::make('Created at', 'created_at') ->withTime() ];} //...
# Format
The format()
method allows you to change the display format of the field value in preview.
format(string $format)
use MoonShine\Fields\Date; //... public function fields(): array{ return [ Date::make('Created at', 'created_at') ->format('d.m.Y') ];} //...