Format date in table

Hi,

On a form component (DateTimePicker) I can change the format of a date, which is great.
Example: MM/DD/YYYY

In a table component (on a column which type is set to Date) I can’t. Is there some way around it to apply a date format there? I would really like to have my date formats consistent across my apps.

Thanks
Michel

Hey there @mm79! Retool ships with Moment.js pre-installed, so you can use that in a column mapper to format your data. For example, if I have a column called date that I want to format in calendar format, I could head over to my table’s settings, click on the column, and add this into the mapper field:

{{ moment(self).calendar() }}

Does that work?

Thanks for your help again Justin. I’ve got it working now. What I did is:

  • Change column type to String
  • Wrote this in the mapper field (i have empty dates as well):
    {{self == undefined ? undefined : moment(self).format(“DD/MM/YY”)}}
1 Like