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')];}//
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()
withTime()
use MoonShine\Fields\Date;//...public function fields(): array{return [Date::make('Created at', 'created_at')->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)
format(string $format)
use MoonShine\Fields\Date;//...public function fields(): array{return [Date::make('Created at', 'created_at')->format('d.m.Y')];}//...
use MoonShine\Fields\Date;//...public function fields(): array{return [Date::make('Created at', 'created_at')->format('d.m.Y')];}//...