How to format a date in a Key-Value Table?

I have a key-value table in which I put the dataset generated by a query.
But there is no way to format the date. Even formatting the date, when retrieving it from SQL does not change the format.
Screenshot 2022-09-30 at 11.55.24
It is currently formatted as MMM dd, yyyy, instead of dd.MM.yyyy what I want.
In tables I can give the column an information how to style it, but the key-value has no possibility.

Hi @ObiOne!

You can try using the moment library to format your date values here. How exactly you'll want to pass it to your key value component can vary depending on what else you're doing with the query data (you might be able to use a query transformer, for instance). A general solution though is to do something like the following

{{ _.mapValues(yourKeyValueObject, date => moment(date).format('DD.MM.YYYY')) }}

This uses the handy lodash library that comes built-in with Retool and should work generally:

Let me know if that helps!

This reformats everydate, but also changes every date to "01.01.2022", although another date is in the original data object. Looks like moment can't reformat the following data: 2022-07-04T00:00:00.000Z

Just that string seems to be working fine for me:

Would you mind posting a screenshot of how you have the component configured? It might also help if you can hover over the object you're passing to _.mapValues so we can take a closer look at is as well :thinking: