I found the afterRead hook but it can just change the value of the date but i want the date to keep its value but be displayed in another format.
I want something like this on the field.
Sorry if you tried this already but might be
dateFormat
in the payload config
displayFormat worked, but is there a way to configure this globally? I only got it working on field level.
like this:
{
name: 'birthDate',
type: 'date',
admin:{
date: {displayFormat: "dd.MM.yyyy"}
}
},
This sounds like the thing i should use but somehow it does not affect the display format in the admin panel.
I use this dateFormat: "do MMMM yyyy, h:mm a". But it only works for collection lists. Even though the docs state. dateFormat: Global date format that will be used for all dates in the Admin panel. Any valid date-fnsformat pattern can be used.
https://payloadcms.com/docs/admin/overview#admin-optionsI gave up for multi language support ๐
Just to add, it is on our radar to set
dateFormat
on a global level in the future (in addition to on a field-by-field basis) ๐๏ธ
https://github.com/payloadcms/payload/discussions/122Star
Discord
online
Get help straight from the Payload team with an Enterprise License.