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

robbiel's avatar

Carbon date appears with invalid value

I have a Nova "Date" field and it's working fine it shows the current date when the page is accessed at first.

However, if the user selects the date picker and change the date it appears always the same date "2022/0/5" that is incorrect its not the date that the user selected. On the db stores correctly like "2022-06-12".

Do you know where can be the issue?

 new Panel('Comments', [
                    ...JSON::make('Comments', [
                        Text::make('Title'),
                        Date::make('Date')
                            ->format('Y/m/d')
                            ->resolveUsing(function ($value) {
                                return Carbon::now()->format('Y/m/d');
                            })
                    ])->data
                ]),

Model:

class Settings extends Model
{
    use HasFactory;

    protected $casts = [
        'notes' => 'array',
    ];
}
0 likes
3 replies
vincent15000's avatar

You probably have ton configure the date picker. What datepicker are you using ?

vincent15000's avatar

@robbiel Oh ok I don't know Nova ... you should change the category of the post and set it to Nova.

1 like

Please or to participate in this conversation.