Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

zsofidev's avatar

How to set default datetime value to Filament v2 DateTimePicker field?

Hi!

I would like to set a default datetime value for the Filament DateTimePicker field. My main goal is to set the current datetime as default, because in the datepicker it takes to long to set the time.

This is my field:

				DateTimePicker::make('my_date')
                    ->label('My date')
                    ->minDate(CarbonImmutable::now()->startOfDay())
                    ->withoutSeconds()
                    ->required(),

I've tried already with ->default() function, but it doesn't change anything. I tried with this: ->default('2023-09-28 10:15:30') and with a simple date as well ->default('2023-09-28')

Has anyone a solution for this?

0 likes
1 reply
ebeneoyen's avatar
DateTimePicker::make('my_date')
                    ->label('My date')
                    ->minDate(CarbonImmutable::now()->startOfDay())
                    ->native()
					->default(now())
                    ->withoutSeconds()
                    ->required(),

It should work when you add native()

Please or to participate in this conversation.