thedevdojo / voyager

Voyager - The Missing Laravel Admin
https://voyager.devdojo.com
MIT License
11.78k stars 2.67k forks source link

Format option does not work on timestamp type fields #1469

Closed ghost closed 6 years ago

ghost commented 7 years ago

Description:

When a data row's type is set to 'timestamp', the format option has no effect on how it is displayed in the 'browse' or 'read' blade templates. It seems to only work for 'date' types.

Steps To Reproduce:

Edit the Bread on any table that has columns of the TIMESTAMP type (e.g. the created_at and update_at columns). Add a custom format option to the json details, and then check the boxes for the column to displayed for Browse and Read.

screen shot 2017-07-15 at 4 54 33 pm

Then after navigating to the Browse or Read page for that table, the custom format will be ignored, and the timestamp will be displayed as its default, which for mysql will be in "Y-m-d G:i:s"

screen shot 2017-07-15 at 4 54 59 pm
peinhu commented 7 years ago

I think it only works for 'date' type, you could use the mutator to format your input data.

public function setCreatedAtAttribute($value)
    {
        $this->attributes['created_at'] = Carbon::parse(request('created_at'))->toDateString();
    }
lancepioch commented 7 years ago

Labels: possible bug

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.