How to format dates in admin 'index' tables

System Information
  • Strapi Version: 3.2.5

I have a list of entities and one column is a ‘date’ field. I’d like to format that date field for this entity listing only. One way I could do that is to use afterFind and modify the value directly. Another way would be to add a new uneditable field and have it store the correctly formatted date beforeSave.

However I’m hoping that there’s a nicer solution that doesn’t involve creating fields.

Thank you for your time.

Can you provide more details here, please?

I have a date field literally called “date”

I would like for the date to show up as YYYY-mm-dd without breaking any of the admin crud functions.

I followed the guide here: Custom Admin - Strapi Developer Documentation

Which changes the date display on some fields in the Admin List section (but notably, not the updated_at field) but doesn’t seem to affect how those are displayed in the item edit screen… still looking for that.

Have you tried creating a file extensions/content-manager/admin/src/utils/dateFormats.js with your preferred formats?

For example:

export default {
  time: 'HH:mm',
  date: 'YYYY-MM-DD',
  datetime: 'YYYY-MM-DD HH:mm',
  timestamp: 'YYYY-MM-DD HH:mm',

@soupette how to do it the v4? Thanks!


thanks, it is work well